[llvm] [SLP][REVEC] Use VL.front()->getType() as ScalarTy. (PR #102437)

Han-Kuan Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 02:54:59 PDT 2024


================
@@ -12391,8 +12391,8 @@ Value *BoUpSLP::vectorizeOperand(TreeEntry *E, unsigned NodeIdx,
     }
     if (IsSameVE) {
       auto FinalShuffle = [&](Value *V, ArrayRef<int> Mask) {
-        ShuffleInstructionBuilder ShuffleBuilder(
-            cast<VectorType>(V->getType())->getElementType(), Builder, *this);
+        ShuffleInstructionBuilder ShuffleBuilder(VL.front()->getType(), Builder,
----------------
HanKuanChen wrote:

The `vectorizeTree` can handles `MinBWs` well. The `VecTy` in `vectorizeTree` consider the `MinBWs`. If the return value from `vectorizeOperand` does not have `VecTy` type, it will be cast back to `MinBWs` width.
Since there is two casting, the following optimization passes should eliminate the castings easily.
I think we don't need to change the cost model here.

But to make things simple, how about this https://github.com/llvm/llvm-project/pull/102437/commits/761040e933219b8e75d620eb01f28ad54076389a?

https://github.com/llvm/llvm-project/pull/102437


More information about the llvm-commits mailing list