[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat May 31 22:36:01 PDT 2003


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.85 -> 1.86

---
Log message:

Implement xform: (X != 0) -> (bool)X


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.85 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.86
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.85	Tue May 27 11:40:51 2003
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Sat May 31 22:35:25 2003
@@ -682,6 +682,9 @@
   // 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





More information about the llvm-commits mailing list