[PATCH] D51392: [IR] add shuffle queries for identity extend/extract

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 30 06:59:36 PDT 2018


lebedev.ri added inline comments.


================
Comment at: include/llvm/IR/Instructions.h:2508-2514
+  /// Return true if this shuffle extends exactly one source vector with undefs
+  /// in the high elements.
+  bool isIdentityWithExtend() const;
+
+  /// Return true if this shuffle extracts the first N elements of exactly one
+  /// source vector.
+  bool isIdentityWithExtract() const;
----------------
spatel wrote:
> lebedev.ri wrote:
> > spatel wrote:
> > > lebedev.ri wrote:
> > > > `isIdentityWithExtend()` sounds very much like [[ https://llvm.org/docs/LangRef.html#zext-to-instruction | `zext` ]]-but-with-undef.
> > > > So maybe `isIdentityWithExtract()` can follow suit and be named `isIdentityWithTruncate()`?
> > > Hmm...that actually makes me less positive about 'extend' because we don't want to confuse these with the per-element zext/sext/trunc ops. 
> > > 
> > > How about 'widen' and 'narrow'? That's actually how I've referred to these ops in a draft patch that would use them.
> > Yet another alternative name for `isIdentityWithExtend()`: `isIdentityWithUndefPadding()`.
> More exact description works for me. Let's go with that unless/until we think of something better.
In the same line of thought, `isIdentityWithExtract()` could be `isIdentityPartial()`.
It won't be identity if the parital-ness is not at the end, so i'd think it is as descriptive.


https://reviews.llvm.org/D51392





More information about the llvm-commits mailing list