[PATCH] D128732: [VectorCombine] Improve shuffle select shuffle-of-shuffles

Sam Tebbs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 4 02:44:30 PDT 2022


samtebbs accepted this revision.
samtebbs added a comment.
This revision is now accepted and ready to land.

LGTM now, cheers.



================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:1499-1507
+  auto GetShuffleOperand = [&](Instruction *I, unsigned Op) -> Value * {
+    auto *SV = dyn_cast<ShuffleVectorInst>(I);
+    if (!SV)
+      return I;
+    if (isa<UndefValue>(SV->getOperand(1)))
+      if (auto *SSV = dyn_cast<ShuffleVectorInst>(SV->getOperand(0)))
+        if (InputShuffles.contains(SSV))
----------------
dmgreen wrote:
> samtebbs wrote:
> > This has the same structure as `GetBaseMaskValue`, so I wonder if `GetMaskValue` can use this. If it makes it messier then having both is OK.
> Hmm. Good point, but I'm not sure how easy it is for them to share logic, unfortunately. They are each returning quite different values, and the parameters are different between the two methods.
Yeah looks like it would be messier to do that. Looks good to me as it is then.


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

https://reviews.llvm.org/D128732



More information about the llvm-commits mailing list