forked from OSchip/llvm-project
[DAG] Make it clear mul(x,x) knownbits bit[1] == 0 check should be for x is undef only
As raised on rGffd0e464b4b9, if x is poison, this fold is still ok.
This commit is contained in:
parent
f131d4d0d0
commit
d83a96f59f
|
@ -3082,6 +3082,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
|
|||
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
|
||||
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
|
||||
bool SelfMultiply = Op.getOperand(0) == Op.getOperand(1);
|
||||
// TODO: SelfMultiply can be poison, but not undef.
|
||||
SelfMultiply &= isGuaranteedNotToBeUndefOrPoison(
|
||||
Op.getOperand(0), DemandedElts, false, Depth + 1);
|
||||
Known = KnownBits::mul(Known, Known2, SelfMultiply);
|
||||
|
|
|
@ -393,7 +393,7 @@ define <4 x i32> @combine_mul_self_knownbits_vector(<4 x i32> %x) {
|
|||
ret <4 x i32> %2
|
||||
}
|
||||
|
||||
; mul(x,x) - bit[1] is 0, but if demanding the other bits the source must not be undef/poison
|
||||
; mul(x,x) - bit[1] is 0, but if demanding the other bits the source must not be undef
|
||||
|
||||
define i64 @combine_mul_self_demandedbits(i64 %x) {
|
||||
; SSE-LABEL: combine_mul_self_demandedbits:
|
||||
|
|
Loading…
Reference in New Issue