summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-09-04 22:43:59 +0000
committerDevang Patel <dpatel@apple.com>2008-09-04 22:43:59 +0000
commitdeafefabae915cf20884fd829d2542f9626786e8 (patch)
tree2e32690fdbb487ee601c0e6900664987cc963233 /lib/Transforms
parentfe89669b772ac6aeb7b8e5b0e3c5e801e46598c7 (diff)
downloadllvm-deafefabae915cf20884fd829d2542f9626786e8.tar.gz
llvm-deafefabae915cf20884fd829d2542f9626786e8.tar.bz2
llvm-deafefabae915cf20884fd829d2542f9626786e8.tar.xz
A loop may be unswitched multiple times. Reconstruct dom info. at the end.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55806 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index 691a67a427..1c4bba295b 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -190,6 +190,7 @@ bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) {
DF = getAnalysisToUpdate<DominanceFrontier>();
DT = getAnalysisToUpdate<DominatorTree>();
currentLoop = L;
+ Function *F = currentLoop->getHeader()->getParent();
bool Changed = false;
do {
assert(currentLoop->isLCSSAForm());
@@ -197,6 +198,13 @@ bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) {
Changed |= processCurrentLoop();
} while(redoLoop);
+ if (Changed) {
+ // FIXME: Reconstruct dom info, because it is not preserved properly.
+ if (DT)
+ DT->runOnFunction(*F);
+ if (DF)
+ DF->runOnFunction(*F);
+ }
return Changed;
}
@@ -450,11 +458,6 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
UnswitchNontrivialCondition(LoopCond, Val, currentLoop);
}
- // FIXME: Reconstruct dom info, because it is not preserved properly.
- if (DT)
- DT->runOnFunction(*F);
- if (DF)
- DF->runOnFunction(*F);
return true;
}