From: Devang Patel Date: Thu, 3 Jul 2008 06:48:21 +0000 (+0000) Subject: Reconstruct dom info, if loop is unswitched. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4be7d294f8045f08bcdbd74f1886ea8121a77022;p=oota-llvm.git Reconstruct dom info, if loop is unswitched. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53086 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index f57b7bb5194..02dac92aa13 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -113,8 +113,8 @@ namespace { AU.addRequiredID(LCSSAID); AU.addPreservedID(LCSSAID); // FIXME: Loop Unswitch does not preserve dominator info in all cases. - // AU.addPreserved(); - // AU.addPreserved(); + AU.addPreserved(); + AU.addPreserved(); } private: @@ -206,7 +206,6 @@ bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) { DT = getAnalysisToUpdate(); currentLoop = L; bool Changed = false; - do { assert(currentLoop->isLCSSAForm()); redoLoop = false; @@ -459,7 +458,13 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){ } else { UnswitchNontrivialCondition(LoopCond, Val, currentLoop); } - + + // FIXME: Reconstruct dom info, because it is not preserved properly. + Function *F = loopHeader->getParent(); + if (DT) + DT->runOnFunction(*F); + if (DF) + DF->runOnFunction(*F); return true; }