[ConstantFold] Allow propagation of poison for and/or i1 · llvm/llvm-project@2fd3037 (original) (raw)

Original file line number Diff line number Diff line change
@@ -1124,14 +1124,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
1124 1124 }
1125 1125
1126 1126 // Binary operations propagate poison.
1127 -// FIXME: Currently, or/and i1 poison aren't folded into poison because
1128 -// it causes miscompilation when combined with another optimization in
1129 -// InstCombine (select i1 -> and/or). The select fold is wrong, but
1130 -// fixing it requires an effort, so temporarily disable this until it is
1131 -// fixed.
1132 -bool PoisonFold = !C1->getType()->isIntegerTy(1) |
1133 - (Opcode != Instruction::Or && Opcode != Instruction::And);
1134 -if (PoisonFold && (isa(C1) |
1127 +if (isa(C1) |
1135 1128 return PoisonValue::get(C1->getType());
1136 1129
1137 1130 // Handle scalar UndefValue and scalable vector UndefValue. Fixed-length