mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Adding i1 is always Xor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51816 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
310d2eb202
commit
fd12a0b20b
@ -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))
|
||||
|
7
test/Transforms/InstCombine/2008-05-31-AddBool.ll
Normal file
7
test/Transforms/InstCombine/2008-05-31-AddBool.ll
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user