diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-04-24 07:30:14 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-04-24 07:30:14 +0000 |
| commit | d6f636a3403b32c9537684570f36d7813304c14a (patch) | |
| tree | 5f1a2c0a6d3a319c4d53d3abd15ff131b5abadd1 /llvm/lib/Transforms | |
| parent | b57d040464e581a07b92fb7115a9bc61180749c6 (diff) | |
| download | bcm5719-llvm-d6f636a3403b32c9537684570f36d7813304c14a.tar.gz bcm5719-llvm-d6f636a3403b32c9537684570f36d7813304c14a.zip | |
Implement xor.ll:test21: select (not C), A, B -> select C, B, A
llvm-svn: 21495
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 532c6612f9d..bb224a1b5d2 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -311,7 +311,7 @@ bool InstCombiner::SimplifyCommutative(BinaryOperator &I) { // 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_castNegVal(Value *V) { 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 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { } } } + + if (BinaryOperator::isNot(CondVal)) { + SI.setOperand(0, BinaryOperator::getNotArgument(CondVal)); + SI.setOperand(1, FalseVal); + SI.setOperand(2, TrueVal); + return &SI; + } + return 0; } |

