mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 03:25:23 +00:00
use getUniqueExitBlocks instead of a manual set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112412 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -707,18 +707,10 @@ void LICM::PromoteValuesInLoop() {
|
|||||||
|
|
||||||
// Now that the body of the loop uses the allocas instead of the original
|
// Now that the body of the loop uses the allocas instead of the original
|
||||||
// memory locations, insert code to copy the alloca value back into the
|
// memory locations, insert code to copy the alloca value back into the
|
||||||
// original memory location on all exits from the loop. Note that we only
|
// original memory location on all exits from the loop.
|
||||||
// want to insert one copy of the code in each exit block, though the loop may
|
|
||||||
// exit to the same block more than once.
|
|
||||||
//
|
|
||||||
SmallPtrSet<BasicBlock*, 16> ProcessedBlocks;
|
|
||||||
|
|
||||||
SmallVector<BasicBlock*, 8> ExitBlocks;
|
SmallVector<BasicBlock*, 8> ExitBlocks;
|
||||||
CurLoop->getExitBlocks(ExitBlocks);
|
CurLoop->getUniqueExitBlocks(ExitBlocks);
|
||||||
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
|
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
|
||||||
if (!ProcessedBlocks.insert(ExitBlocks[i]))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Copy all of the allocas into their memory locations.
|
// Copy all of the allocas into their memory locations.
|
||||||
BasicBlock::iterator BI = ExitBlocks[i]->getFirstNonPHI();
|
BasicBlock::iterator BI = ExitBlocks[i]->getFirstNonPHI();
|
||||||
Instruction *InsertPos = BI;
|
Instruction *InsertPos = BI;
|
||||||
|
Reference in New Issue
Block a user