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

Chris Lattner lattner at cs.uiuc.edu
Thu May 5 19:07:52 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.336 -> 1.337
---
Log message:

Implement xor.ll:test22


---
Diffs of the changes:  (+9 -0)

 InstructionCombining.cpp |    9 +++++++++
 1 files changed, 9 insertions(+)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.336 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.337
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.336	Thu May  5 20:53:19 2005
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu May  5 21:07:39 2005
@@ -3550,6 +3550,15 @@
                              ->getOpcode(), Op0c, Op1c);
           }
         }
+
+        // cast (xor bool X, true) to int  --> xor (cast bool X to int), 1
+        if (SrcBitSize == 1 && SrcI->getOpcode() == Instruction::Xor &&
+            Op1 == ConstantBool::True &&
+            (!Op0->hasOneUse() || !isa<SetCondInst>(Op0))) {
+          Value *New = InsertOperandCastBefore(Op0, DestTy, &CI);
+          return BinaryOperator::createXor(New,
+                                           ConstantInt::get(CI.getType(), 1));
+        }
         break;
       case Instruction::Shl:
         // Allow changing the sign of the source operand.  Do not allow changing






More information about the llvm-commits mailing list