1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Adding i1 is always Xor.

llvm-svn: 51816
This commit is contained in:
Nick Lewycky 2008-05-31 17:10:28 +00:00
parent 611c1b0f47
commit cdcdcddc85
2 changed files with 10 additions and 0 deletions

View File

@ -2551,6 +2551,9 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
bool Changed = SimplifyCommutative(I);
Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
if (I.getType() == Type::Int1Ty)
return BinaryOperator::CreateXor(LHS, RHS);
if (Constant *RHSC = dyn_cast<Constant>(RHS)) {
// X + undef -> undef
if (isa<UndefValue>(RHS))

View File

@ -0,0 +1,7 @@
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {xor}
; PR2389
define i1 @test(i1 %a, i1 %b) {
%A = add i1 %a, %b
ret i1 %A
}