[PATCH] D76727: [VectorCombine] transform bitcasted shuffle to narrower elements

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 07:32:20 PDT 2020


spatel marked 3 inline comments as done.
spatel added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:257
+  Type *SrcTy = V->getType();
+  if (!DestTy->isVectorTy() || I.getOperand(0)->getType() != SrcTy)
+    return false;
----------------
lebedev.ri wrote:
> I'm not sure how the second part of the check can fail?
That's one that I've tripped on a few times in the past (but failed to add a test for here): a shufflevector can change the vector length (the mask value can have more/less elements than the source values).

I'll add negative tests for both of those clauses.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:267-268
+
+  if (TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, SrcTy) >
+      TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, DestTy))
+    return false;
----------------
The types are reversed here. This is covered by the SSE2 run of the 1st test, but I still missed the bug.


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

https://reviews.llvm.org/D76727





More information about the llvm-commits mailing list