diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-05-06 02:07:39 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-05-06 02:07:39 +0000 | 
| commit | 7208616ec0cec33a03565bfe68a923ab300a6e54 (patch) | |
| tree | ba600a97aa0a745527181133aefd58b14ffe5c18 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp | |
| parent | 4c2d3781aa452cfa80b10e93fc5eceac09978209 (diff) | |
| download | bcm5719-llvm-7208616ec0cec33a03565bfe68a923ab300a6e54.tar.gz bcm5719-llvm-7208616ec0cec33a03565bfe68a923ab300a6e54.zip | |
Implement xor.ll:test22
llvm-svn: 21713
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 4d96cbfccea..6824c345524 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -3550,6 +3550,15 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) {                               ->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 | 

