aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 61acad04f3..f8f0573395 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -1294,6 +1294,10 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op,
ShVal = InsertNewInstBefore(new ShiftInst(Instruction::Shr, ShVal,
OpRHS, Op->getName()),
TheAnd);
+ Value *AndRHS2 = ConstantExpr::getCast(AndRHS, ShVal->getType());
+ ShVal = InsertNewInstBefore(BinaryOperator::createAnd(ShVal, AndRHS2,
+ TheAnd.getName()),
+ TheAnd);
return new CastInst(ShVal, Op->getType());
}
}