Update dom tree. Fix PR 2372.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51887 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2008-06-02 22:52:56 +00:00
parent 33b625bee4
commit 2f170997b5
2 changed files with 30 additions and 1 deletions

View File

@@ -569,7 +569,6 @@ void LoopUnswitch::EmitPreheaderBranchOnCondition(Value *LIC, Constant *Val,
// Insert the new branch.
BranchInst::Create(TrueDest, FalseDest, BranchVal, InsertPt);
}
@@ -607,6 +606,10 @@ void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond,
// insert the new conditional branch.
EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH,
OrigPH->getTerminator());
if (DT) {
DT->changeImmediateDominator(NewExit, OrigPH);
DT->changeImmediateDominator(NewPH, OrigPH);
}
LPM->deleteSimpleAnalysisValue(OrigPH->getTerminator(), L);
OrigPH->getTerminator()->eraseFromParent();