forked from OSchip/llvm-project
parent
5635295266
commit
790b4bf9a9
|
@ -4443,14 +4443,10 @@ Instruction *InstCombiner::FoldOrWithConstants(BinaryOperator &I, Value *Op,
|
||||||
APInt Xor = CI1->getValue() ^ CI2->getValue();
|
APInt Xor = CI1->getValue() ^ CI2->getValue();
|
||||||
if (!Xor.isAllOnesValue()) return 0;
|
if (!Xor.isAllOnesValue()) return 0;
|
||||||
|
|
||||||
if (V1 == B) {
|
if (V1 == A || V1 == B)
|
||||||
Instruction *NewOp =
|
Instruction *NewOp =
|
||||||
InsertNewInstBefore(BinaryOperator::CreateAnd(A, CI1), I);
|
InsertNewInstBefore(BinaryOperator::CreateAnd((V1 == A) ? B : A, CI1), I);
|
||||||
return BinaryOperator::CreateOr(NewOp, B);
|
return BinaryOperator::CreateOr(NewOp, V1);
|
||||||
} else if (V1 == A) {
|
|
||||||
Instruction *NewOp =
|
|
||||||
InsertNewInstBefore(BinaryOperator::CreateAnd(B, CI1), I);
|
|
||||||
return BinaryOperator::CreateOr(NewOp, A);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue