diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 978a3db7387..14e2c70a8c9 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -768,7 +768,9 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op, ConstantIntegral *AndRHS, BinaryOperator &TheAnd) { Value *X = Op->getOperand(0); - Constant *Together = ConstantExpr::get(Instruction::And, AndRHS, OpRHS); + Constant *Together = 0; + if (!isa(Op)) + Together = ConstantExpr::get(Instruction::And, AndRHS, OpRHS); switch (Op->getOpcode()) { case Instruction::Xor: