[PATCH] D72467: [WIP] Remove "mask" operand from shufflevector.
Simon Moll via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 06:26:12 PST 2020
simoll added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4413
unsigned MaxRecurse) {
- if (isa<UndefValue>(Mask))
+ if (all_of(Mask, [](int Elem) { return Elem == -1; }))
return UndefValue::get(RetTy);
----------------
efriedma wrote:
> xbolva00 wrote:
> > maybe introduce new helper function to check if mask is "undef"?
> I could introduce ShuffleVectorInst::MaskIsAllUndef and ShuffleVectorInst::MaskIsAllZero, I guess. Not sure how helpful that actually is for a predicate that can be expressed on one line anyway.
How about introducing the constant `UndefMaskElem` and changing this to something like:
`if (all_of(Mask, [](int Elem) { return Elem == UndefMaskElem; }))`
That would make it self-explanatory again and wouldn't expose the specific encoding of undef mask elems.
================
Comment at: llvm/lib/IR/Instructions.cpp:1871
if (MaskElt == -1) {
- NewMask[i] = UndefValue::get(Int32Ty);
+ NewMask[i] = -1;
continue;
----------------
With the suggestion: `NewMask[i] = UndefMaskElem`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72467/new/
https://reviews.llvm.org/D72467
More information about the llvm-commits
mailing list