llvm.org GIT mirror llvm / 3a3d1ef
Merge into release for PR1690. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_21@42200 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 13 years ago
1 changed file(s) with 12 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
582582 // insert the new conditional branch.
583583 EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH,
584584 OrigPH->getTerminator());
585 LPM->deleteSimpleAnalysisValue(OrigPH->getTerminator(), L);
585586 OrigPH->getTerminator()->eraseFromParent();
586 LPM->deleteSimpleAnalysisValue(OrigPH->getTerminator(), L);
587587
588588 // We need to reprocess this loop, it could be unswitched again.
589589 redoLoop = true;
758758
759759 // Emit the new branch that selects between the two versions of this loop.
760760 EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR);
761 LPM->deleteSimpleAnalysisValue(OldBR, L);
761762 OldBR->eraseFromParent();
762 LPM->deleteSimpleAnalysisValue(OldBR, L);
763763
764764 // Update dominator info
765765 if (DF && DT) {
858858 for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
859859 UI != E; ++UI)
860860 Worklist.push_back(cast(*UI));
861 LPM->deleteSimpleAnalysisValue(I, L);
862 RemoveFromWorklist(I, Worklist);
861863 I->replaceAllUsesWith(V);
862864 I->eraseFromParent();
863 LPM->deleteSimpleAnalysisValue(I, L);
864 RemoveFromWorklist(I, Worklist);
865865 ++NumSimplify;
866866 }
867867
888888 // Remove the branch from the latch to the header block, this makes
889889 // the header dead, which will make the latch dead (because the header
890890 // dominates the latch).
891 LPM->deleteSimpleAnalysisValue(Pred->getTerminator(), L);
891892 Pred->getTerminator()->eraseFromParent();
892 LPM->deleteSimpleAnalysisValue(Pred->getTerminator(), L);
893893 new UnreachableInst(Pred);
894894
895895 // The loop is now broken, remove it from LI.
946946 Succs.erase(std::unique(Succs.begin(), Succs.end()), Succs.end());
947947
948948 // Remove the basic block, including all of the instructions contained in it.
949 LPM->deleteSimpleAnalysisValue(BB, L);
949950 BB->eraseFromParent();
950 LPM->deleteSimpleAnalysisValue(BB, L);
951951 // Remove successor blocks here that are not dead, so that we know we only
952952 // have dead blocks in this list. Nondead blocks have a way of becoming dead,
953953 // then getting removed before we revisit them, which is badness.
10491049 Instruction* OldTerm = Old->getTerminator();
10501050 new BranchInst(Split, SI->getSuccessor(i),
10511051 ConstantInt::getTrue(), OldTerm);
1052
1052
1053 LPM->deleteSimpleAnalysisValue(Old->getTerminator(), L);
10531054 Old->getTerminator()->eraseFromParent();
1054
10551055
10561056 PHINode *PN;
10571057 for (BasicBlock::iterator II = SI->getSuccessor(i)->begin();
11021102 for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
11031103 if (Instruction *Use = dyn_cast(I->getOperand(i)))
11041104 Worklist.push_back(Use);
1105 I->eraseFromParent();
11061105 LPM->deleteSimpleAnalysisValue(I, L);
11071106 RemoveFromWorklist(I, Worklist);
1107 I->eraseFromParent();
11081108 ++NumSimplify;
11091109 continue;
11101110 }
11651165 // Move all of the successor contents from Succ to Pred.
11661166 Pred->getInstList().splice(BI, Succ->getInstList(), Succ->begin(),
11671167 Succ->end());
1168 LPM->deleteSimpleAnalysisValue(BI, L);
11681169 BI->eraseFromParent();
1169 LPM->deleteSimpleAnalysisValue(BI, L);
11701170 RemoveFromWorklist(BI, Worklist);
11711171
11721172 // If Succ has any successors with PHI nodes, update them to have
11751175
11761176 // Remove Succ from the loop tree.
11771177 LI->removeBlock(Succ);
1178 LPM->deleteSimpleAnalysisValue(Succ, L);
11781179 Succ->eraseFromParent();
1179 LPM->deleteSimpleAnalysisValue(Succ, L);
11801180 ++NumSimplify;
11811181 } else if (ConstantInt *CB = dyn_cast(BI->getCondition())){
11821182 // Conditional branch. Turn it into an unconditional branch, then
11881188 BasicBlock *LiveSucc = BI->getSuccessor(!CB->getZExtValue());
11891189 DeadSucc->removePredecessor(BI->getParent(), true);
11901190 Worklist.push_back(new BranchInst(LiveSucc, BI));
1191 LPM->deleteSimpleAnalysisValue(BI, L);
11911192 BI->eraseFromParent();
1192 LPM->deleteSimpleAnalysisValue(BI, L);
11931193 RemoveFromWorklist(BI, Worklist);
11941194 ++NumSimplify;
11951195