forked from OSchip/llvm-project
parent
cd92aebd1f
commit
df9242a833
|
@ -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))
|
||||
|
|
|
@ -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