diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-05-25 18:17:13 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-05-25 18:17:13 +0000 |
commit | 9605a698b0c879d78a9196aebf62244e3125036f (patch) | |
tree | 31d0c7051163da7acaca6c5242ddb2337e666be0 /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | |
parent | d72cc55fcc0ab7283777be5861394fc862976e81 (diff) | |
download | bcm5719-llvm-9605a698b0c879d78a9196aebf62244e3125036f.tar.gz bcm5719-llvm-9605a698b0c879d78a9196aebf62244e3125036f.zip |
Simplify r132022 based on Cameron's feedback.
llvm-svn: 132071
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index a33e7956433..01a99af1439 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -919,18 +919,11 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC, BasicBlock *Switch = SI->getParent(); BasicBlock *SISucc = SI->getSuccessor(DeadCase); BasicBlock *Latch = L->getLoopLatch(); - // If the DeadCase successor dominates all of the predecessors of the - // loop latch, then the transformation isn't safe since it will delete - // the predecessor edges to the latch. - if (Latch) { - bool DominateAll = true; - for (pred_iterator PI = pred_begin(Latch), PE = pred_end(Latch); - DominateAll && PI != PE; ++PI) - if (!DT->dominates(SISucc, *PI)) - DominateAll = false; - if (DominateAll) - continue; - } + // If the DeadCase successor dominates the loop latch, then the + // transformation isn't safe since it will delete the sole predecessor edge + // to the latch. + if (Latch && DT->dominates(SISucc, Latch)) + continue; // FIXME: This is a hack. We need to keep the successor around // and hooked up so as to preserve the loop structure, because |