diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-01 03:35:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-01 03:35:25 +0000 |
commit | 074d84c746f6e4592be3e87ed56ea6b9059d0e82 (patch) | |
tree | 982f78cdc4ece4b8940d2413cf3decdd40349322 /lib | |
parent | 4d6404f7629a35ab448a961de516741a8cf68767 (diff) | |
download | external_llvm-074d84c746f6e4592be3e87ed56ea6b9059d0e82.zip external_llvm-074d84c746f6e4592be3e87ed56ea6b9059d0e82.tar.gz external_llvm-074d84c746f6e4592be3e87ed56ea6b9059d0e82.tar.bz2 |
Implement xform: (X != 0) -> (bool)X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6506 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index f78f675..21c58b6 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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<ConstantInt>(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 |