[PATCH] D50840: [InstCombine] Extend collectShuffleElements to support extract/zext/insert patterns

Joey Gouly via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 16 07:12:11 PDT 2018


joey added a comment.

In https://reviews.llvm.org/D50840#1202436, @lebedev.ri wrote:

> 1. Why is this limited to extensions? Why can't this also be done for `trunc`? Or more generally, why don't we want to do this if the same operation is applied for all the elements?
> 2. Do the vectorizer passes handle this? (Especially in light of the last question of `1.`)




1. No real reason, just the test case I wrote the code for. I can do the same for `trunc` as well. I'm not sure if it makes sense for the other `CastInst` operators though.
2. I tried the test case with `opt -slp-vectorizer` and it doesn't catch it. Anything else I can try?



================
Comment at: lib/Transforms/InstCombine/InstCombineVectorOps.cpp:477
+    if(ExtOpc)
+      if (CastInst *ZI = dyn_cast<CastInst>(ScalarOp))
+        if (ZI->getOpcode() == *ExtOpc)
----------------
lebedev.ri wrote:
> Why `ZI`?
> Is this limited to `zext`?
> `CI` perhaps?
ZI just because I originally wrote the patch for ZExtInst. I can change that to CI. It works for `zext` and `sext` currently.


Repository:
  rL LLVM

https://reviews.llvm.org/D50840





More information about the llvm-commits mailing list