forked from OSchip/llvm-project
[ConstantFold] Allow propagation of poison for and/or i1
They were disallowed due to its bad interaction with select i1 -> and/or i1. The transformation is now disabled by D101191, so let's revive this.
This commit is contained in:
parent
00d3f7cc3c
commit
2fd3037ac6
|
@ -1124,14 +1124,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Binary operations propagate poison.
|
// Binary operations propagate poison.
|
||||||
// FIXME: Currently, or/and i1 poison aren't folded into poison because
|
if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2))
|
||||||
// it causes miscompilation when combined with another optimization in
|
|
||||||
// InstCombine (select i1 -> and/or). The select fold is wrong, but
|
|
||||||
// fixing it requires an effort, so temporarily disable this until it is
|
|
||||||
// fixed.
|
|
||||||
bool PoisonFold = !C1->getType()->isIntegerTy(1) ||
|
|
||||||
(Opcode != Instruction::Or && Opcode != Instruction::And);
|
|
||||||
if (PoisonFold && (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)))
|
|
||||||
return PoisonValue::get(C1->getType());
|
return PoisonValue::get(C1->getType());
|
||||||
|
|
||||||
// Handle scalar UndefValue and scalable vector UndefValue. Fixed-length
|
// Handle scalar UndefValue and scalable vector UndefValue. Fixed-length
|
||||||
|
|
Loading…
Reference in New Issue