fix a bug in a recent patch
authorChris Lattner <sabre@nondot.org>
Sat, 13 Jan 2007 00:02:49 +0000 (00:02 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 13 Jan 2007 00:02:49 +0000 (00:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33164 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopUnswitch.cpp

index 80d4311ebcba2896454709e9bd7700ccdd86de33..64ff68b6f73d7f479bea40fac0b5a1dc4693a707 100644 (file)
@@ -486,7 +486,7 @@ static void EmitPreheaderBranchOnCondition(Value *LIC, Constant *Val,
   // Insert a conditional branch on LIC to the two preheaders.  The original
   // code is the true version and the new code is the false version.
   Value *BranchVal = LIC;
-  if (Val->getType() != Type::Int1Ty)
+  if (Val->getType() != Type::Int1Ty || !isa<ConstantInt>(Val))
     BranchVal = new ICmpInst(ICmpInst::ICMP_EQ, LIC, Val, "tmp", InsertPt);
   else if (Val != ConstantInt::getTrue())
     // We want to enter the new loop when the condition is true.