[PATCH] D72467: [WIP] Remove "mask" operand from shufflevector.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 15:08:04 PST 2020


efriedma marked an inline comment as done.
efriedma 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);
----------------
simoll wrote:
> 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.
> 
You mean just llvm::UndefMaskElem?  I guess that makes sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72467





More information about the cfe-commits mailing list