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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 12:36:02 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:
> > `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()`.


https://reviews.llvm.org/D51392





More information about the llvm-commits mailing list