From fe57d109b6414d6728825a64857335afcd2bd13e Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 3 Nov 2008 19:38:07 +0000 Subject: Ignore conditions that are outside the loop. llvm-svn: 58631 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp') diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index 65034f5577c..31e875275b8 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -167,8 +167,10 @@ static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) { // TODO: Handle: br (VARIANT|INVARIANT). // TODO: Hoist simple expressions out of loops. - if (L->isLoopInvariant(Cond)) return Cond; - + if (Instruction *I = dyn_cast(Cond)) + if (!L->contains(I->getParent())) + return 0; + if (BinaryOperator *BO = dyn_cast(Cond)) if (BO->getOpcode() == Instruction::And || BO->getOpcode() == Instruction::Or) { -- cgit v1.2.3