diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index f78f6750ef65..21c58b696e0c 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -682,6 +682,9 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) { // integers at the end of their ranges... // if (ConstantInt *CI = dyn_cast(Op1)) { + if (CI->isNullValue() && I.getOpcode() == Instruction::SetNE) + return new CastInst(Op0, Type::BoolTy, I.getName()); + // Check to see if we are comparing against the minimum or maximum value... if (CI->isMinValue()) { if (I.getOpcode() == Instruction::SetLT) // A < MIN -> FALSE