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 | 791ac1a4c853a80caea68a463cab8814aec5e10a (patch) | |
| tree | 0876b0fb51d38689bd8d283780f4f012560c2d51 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp | |
| parent | ef337482487f6bd39e2d6620afd71ad9a470e058 (diff) | |
| download | bcm5719-llvm-791ac1a4c853a80caea68a463cab8814aec5e10a.tar.gz bcm5719-llvm-791ac1a4c853a80caea68a463cab8814aec5e10a.zip | |
Implement xform: (X != 0) -> (bool)X
llvm-svn: 6506
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index f78f6750ef6..21c58b696e0 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<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 |

