BasicBlock *ExitBlock = ExitBlocks[i];
if (isExitBlockDominatedByBlockInLoop(ExitBlock, InstOrigBB)) {
- std::set<BasicBlock*>::iterator SI =
- InsertedBlocks.lower_bound(ExitBlock);
// If we haven't already processed this exit block, do so now.
- if (SI == InsertedBlocks.end() || *SI != ExitBlock) {
+ if (InsertedBlocks.insert(ExitBlock).second) {
// Insert the code after the last PHI node...
BasicBlock::iterator InsertPt = ExitBlock->begin();
while (isa<PHINode>(InsertPt)) ++InsertPt;
// Now that we have inserted the instruction, store it into the alloca
new StoreInst(New, AI, InsertPt);
-
- // Remember we processed this block
- InsertedBlocks.insert(SI, ExitBlock);
}
}
}