summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-04-30 09:23:48 +0000
committerBill Wendling <isanbard@gmail.com>2012-04-30 09:23:48 +0000
commit712d85a8c01591a5de9e91d6d8dc1a0a4c667546 (patch)
tree374b42a78b176c4a009f9b01c7c67d71997734a3 /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
parent55b3990837e000c47ae219676b936779a7f116e7 (diff)
downloadbcm5719-llvm-712d85a8c01591a5de9e91d6d8dc1a0a4c667546.tar.gz
bcm5719-llvm-712d85a8c01591a5de9e91d6d8dc1a0a4c667546.zip
Remove hack from r154987. The problem persists even with it, so it's not even a good hack.
llvm-svn: 155813
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 04b825b168f..7e485b8113d 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -420,15 +420,6 @@ bool LoopUnswitch::processCurrentLoop() {
if (!BranchesInfo.countLoop(currentLoop))
return false;
- // Loops with invokes, whose unwind edge escapes the loop, cannot be
- // unswitched because splitting their edges are non-trivial and don't preserve
- // loop simplify information.
- for (Loop::block_iterator I = currentLoop->block_begin(),
- E = currentLoop->block_end(); I != E; ++I)
- if (const InvokeInst *II = dyn_cast<InvokeInst>((*I)->getTerminator()))
- if (!currentLoop->contains(II->getUnwindDest()))
- return false;
-
// Loop over all of the basic blocks in the loop. If we find an interior
// block that is branching on a loop-invariant condition, we can unswitch this
// loop.
@@ -633,11 +624,10 @@ bool LoopUnswitch::IsTrivialUnswitchCondition(Value *Cond, Constant **Val,
/// LoopCond == Val to simplify the loop. If we decide that this is profitable,
/// unswitch the loop, reprocess the pieces, then return true.
bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val) {
-
Function *F = loopHeader->getParent();
-
Constant *CondVal = 0;
BasicBlock *ExitBlock = 0;
+
if (IsTrivialUnswitchCondition(LoopCond, &CondVal, &ExitBlock)) {
// If the condition is trivial, always unswitch. There is no code growth
// for this case.
OpenPOWER on IntegriCloud