aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 63de8fa222..645120510e 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -4818,7 +4818,9 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) {
if (Op1CV && (Op1CV != (KnownZero^TypeMask))) {
// (X&4) == 2 --> false
// (X&4) != 2 --> true
- return ReplaceInstUsesWith(CI, ConstantBool::get(isSetNE));
+ Constant *Res = ConstantBool::get(isSetNE);
+ Res = ConstantExpr::getCast(Res, CI.getType());
+ return ReplaceInstUsesWith(CI, Res);
}
unsigned ShiftAmt = Log2_64(KnownZero^TypeMask);