| 1801 | } |
| 1802 | |
| 1803 | void BeMCLoopDetector::DetectLoops(BeMCBlock* mcBlock, BeVTrackingList* predBlocksSeen) |
| 1804 | { |
| 1805 | mMCContext->mDetectLoopIdx++; |
| 1806 | |
| 1807 | auto node = &mNodes[mcBlock->mBlockIdx]; |
| 1808 | auto blocksSeen = mTrackingContext.Merge(node->mPredBlocksSeen, predBlocksSeen); |
| 1809 | if (blocksSeen == node->mPredBlocksSeen) |
| 1810 | return; |
| 1811 | node->mPredBlocksSeen = blocksSeen; |
| 1812 | |
| 1813 | //SizedArray<int, 2> addVec = { mcBlock->mBlockIdx }; |
| 1814 | //auto newBlocksSeen = mTrackingContext.Add(blocksSeen, addVec, false); |
| 1815 | |
| 1816 | auto newBlocksSeen = mTrackingContext.Add(blocksSeen, mcBlock->mBlockIdx, false); |
| 1817 | if (newBlocksSeen == blocksSeen) |
| 1818 | { |
| 1819 | // Our ID was already set, so this is a re-entry and thus we are looped |
| 1820 | mcBlock->mIsLooped = true; |
| 1821 | } |
| 1822 | blocksSeen = newBlocksSeen; |
| 1823 | |
| 1824 | for (auto succ : mcBlock->mSuccs) |
| 1825 | { |
| 1826 | DetectLoops(succ, blocksSeen); |
| 1827 | } |
| 1828 | } |
| 1829 | |
| 1830 | void BeMCLoopDetector::DetectLoops() |
| 1831 | { |