[PATCH] D100486: [COST]Improve cost model for shuffles in SLP.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 24 12:57:57 PDT 2021
ABataev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3633-3637
+ auto *FinalVecTy =
+ FixedVectorType::get(VecTy->getElementType(), ReuseShuffleNumbers);
ReuseShuffleCost =
- TTI->getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, VecTy,
- E->ReuseShuffleIndices);
+ TTI->getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
+ FinalVecTy, E->ReuseShuffleIndices);
----------------
We incorrectly calculate the cost here (using the wrong vector type), with this fix and without this patch at least 4 X86 tests are not vectorized anymore.
================
Comment at: llvm/test/Transforms/SLPVectorizer/AArch64/PR38339.ll:6-16
+; CHECK-NEXT: [[T2:%.*]] = extractelement <2 x i16> [[X:%.*]], i32 0
+; CHECK-NEXT: [[T3:%.*]] = extractelement <2 x i16> [[X]], i32 1
; CHECK-NEXT: [[PTR0:%.*]] = getelementptr inbounds [4 x i16], [4 x i16]* undef, i16 0, i16 0
; CHECK-NEXT: [[PTR1:%.*]] = getelementptr inbounds [4 x i16], [4 x i16]* undef, i16 0, i16 1
; CHECK-NEXT: [[PTR2:%.*]] = getelementptr inbounds [4 x i16], [4 x i16]* undef, i16 0, i16 2
; CHECK-NEXT: [[PTR3:%.*]] = getelementptr inbounds [4 x i16], [4 x i16]* undef, i16 0, i16 3
+; CHECK-NEXT: store i16 [[T2]], i16* [[A:%.*]], align 2
----------------
These regressions are caused by the incomplete cost model for AArch64, no cost for PermuteSingleSrc shuffle kind for VFxi16
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100486/new/
https://reviews.llvm.org/D100486
More information about the llvm-commits
mailing list