[llvm] [SLP][REVEC] Make SLP vectorize shufflevector. (PR #102489)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 17:34:44 PDT 2024
================
@@ -10116,6 +10212,13 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
// TODO: Check the reverse order too.
return VecCost;
};
+ if (SLPReVec && !E->isAltShuffle())
+ return GetCostDiff(GetScalarCost, [](InstructionCost) {
+ // shufflevector will be eliminated by instcombine because the
+ // shufflevector masks are used in order (guaranteed by
+ // getShufflevectorNumGroups). The vector cost is 0.
----------------
HanKuanChen wrote:
The first test?
```
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i32>, ptr [[IN:%.*]], align 1
; CHECK-NEXT: [[TMP1:%.*]] = zext <8 x i32> [[TMP0]] to <8 x i64>
; CHECK-NEXT: store <8 x i64> [[TMP1]], ptr [[OUT:%.*]], align 8
; CHECK-NEXT: ret void
;
```
shufflevector is eliminated.
https://github.com/llvm/llvm-project/pull/102489
More information about the llvm-commits
mailing list