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

Chris Lattner lattner at cs.uiuc.edu
Sun Apr 24 00:30:28 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.327 -> 1.328
---
Log message:

Implement xor.ll:test21:  select (not C), A, B -> select C, B, A


---
Diffs of the changes:  (+10 -2)

 InstructionCombining.cpp |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.327 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.328
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.327	Sun Apr 24 01:59:08 2005
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Sun Apr 24 02:30:14 2005
@@ -311,7 +311,7 @@
 //
 static inline Value *dyn_castNegVal(Value *V) {
   if (BinaryOperator::isNeg(V))
-    return BinaryOperator::getNegArgument(cast<BinaryOperator>(V));
+    return BinaryOperator::getNegArgument(V);
 
   // Constants can be considered to be negated values if they can be folded.
   if (ConstantInt *C = dyn_cast<ConstantInt>(V))
@@ -321,7 +321,7 @@
 
 static inline Value *dyn_castNotVal(Value *V) {
   if (BinaryOperator::isNot(V))
-    return BinaryOperator::getNotArgument(cast<BinaryOperator>(V));
+    return BinaryOperator::getNotArgument(V);
 
   // Constants can be considered to be not'ed values...
   if (ConstantIntegral *C = dyn_cast<ConstantIntegral>(V))
@@ -3885,6 +3885,14 @@
           }
         }
   }
+
+  if (BinaryOperator::isNot(CondVal)) {
+    SI.setOperand(0, BinaryOperator::getNotArgument(CondVal));
+    SI.setOperand(1, FalseVal);
+    SI.setOperand(2, TrueVal);
+    return &SI;
+  }
+
   return 0;
 }
 






More information about the llvm-commits mailing list