diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 3686e49dcdd..a4da2501f9f 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -442,7 +442,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 (!isa(BranchVal)) { + if (!isa(Val)) { BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt); } else if (Val != ConstantBool::True) { // We want to enter the new loop when the condition is true.