[llvm] [SelectionDAG] Make sure demanded lanes for AND/MUL-by-zero are frozen (PR #180727)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 10 07:04:45 PST 2026
================
@@ -3806,19 +3806,22 @@ bool TargetLowering::SimplifyDemandedVectorElts(
if (SimplifyDemandedVectorElts(Op1, DemandedElts, SrcUndef, SrcZero, TLO,
Depth + 1))
return true;
- // If we know that a demanded element was zero in Op1 we don't need to
- // demand it in Op0 - its guaranteed to be zero.
- APInt DemandedElts0 = DemandedElts & ~SrcZero;
- if (SimplifyDemandedVectorElts(Op0, DemandedElts0, KnownUndef, KnownZero,
+ // FIXME: If we know that a demanded element was zero in Op1 we don't need
+ // to demand it in Op0 - its guaranteed to be zero. There is however a
+ // restriction, as we must not make any of the originally demanded elements
+ // more poisonous. We could reduce amount of elements demanded, but then we
+ // also need a to inform SimplifyDemandedVectorElts that some elements must
+ // not be made more poisonous.
----------------
RKSimon wrote:
How about:
```
APInt DemandedElts0 = DemandedElts;
if (isGuaranteedNotToBePoison(Op0, SrcZero))
DemandedElts0 = DemandedElts & ~SrcZero;
```
https://github.com/llvm/llvm-project/pull/180727
More information about the llvm-commits
mailing list