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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 30 06:56:40 PDT 2018


spatel marked an inline comment as done.
spatel 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;
----------------
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.


https://reviews.llvm.org/D51392





More information about the llvm-commits mailing list