[PATCH] D57372: Demanded elements support for masked.load and masked.gather

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 3 04:51:54 PST 2019


RKSimon added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1455
+            DemandedPtrs.clearBit(i);
+          else if (CElt->isAllOnesValue())
+            DemandedPassThrough.clearBit(i);
----------------
reames wrote:
> RKSimon wrote:
> > We're not 100% consistent with this but for selects we try to use:
> > 
> > ```
> > if (CElt->isNullValue())
> >   DemandedPtrs.clearBit(i);
> > else
> >   DemandedPassThrough.clearBit(i);
> > ```
> This would be wrong.  Consider any constant expr or other constant of indeterminate value.  
@spatel may be able to advise, but Instruction::Select does this:
```
Constant *CElt = CV->getAggregateElement(i);
if (isa<ConstantExpr>(CElt))
  continue;
// TODO: If a select condition element is undef, we can demand from
// either side. If one side is known undef, choosing that side would
// propagate undef.
if (CElt->isNullValue())
  DemandedLHS.clearBit(i);
else
  DemandedRHS.clearBit(i);

```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57372/new/

https://reviews.llvm.org/D57372





More information about the llvm-commits mailing list