aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-12-08 17:02:37 +0000
committerDevang Patel <dpatel@apple.com>2008-12-08 17:02:37 +0000
commit6d9896f153359785299651bcffd363fdefd67a4c (patch)
tree312cf90ec40df42fd17af83c64279d789f95154f
parent174f938bd042a19d1a840eef6ed162fc938e2fd9 (diff)
Undo previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60701 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp4
-rw-r--r--test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll2
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index 2bf194dbb7..97aa475a67 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -168,9 +168,7 @@ static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) {
// TODO: Handle: br (VARIANT|INVARIANT).
// TODO: Hoist simple expressions out of loops.
- if (Instruction *I = dyn_cast<Instruction>(Cond))
- if (!L->contains(I->getParent()))
- return 0;
+ if (L->isLoopInvariant(Cond)) return Cond;
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Cond))
if (BO->getOpcode() == Instruction::And ||
diff --git a/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll b/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
index 430ada4e8c..3bc57265ce 100644
--- a/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
+++ b/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -loop-unswitch -stats | not grep loop-unswitch
+; RUN: llvm-as < %s | opt -loop-unswitch -verify -disable-output
define void @test_fc_while_continue_or(float %x, float %y, float* %result) nounwind {