[llvm] [SLP] Fix cost estimation of external uses with wrong VF (PR #148185)
Gaƫtan Bossu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 11 06:04:33 PDT 2025
================
@@ -31,3 +31,34 @@ define void @test() {
store double %res4, ptr getelementptr inbounds ([8 x double], ptr @dst, i32 0, i64 3), align 8
ret void
}
+
+; Same as above, but %a7 is also used as a scalar and must be extracted from
+; the wide load. (Or in this case, kept as a scalar load).
+define double @test_with_extract() {
+; CHECK-LABEL: @test_with_extract(
+; CHECK-NEXT: [[TMP1:%.*]] = load <8 x double>, ptr @src, align 8
+; CHECK-NEXT: [[A7:%.*]] = load double, ptr getelementptr inbounds ([8 x double], ptr @src, i32 0, i64 7), align 8
----------------
gbossu wrote:
Sorry I wasn't very precise, I meant `getVectorInstrCost` implementations don't generally check if the lane is in bounds, but they do indeed check for specific values like `0` or `-1`.
As mentioned in the description, the added assert **does trigger crashes** if `BundleWidth` isn't correctly computed. I thought this would be enough to show that the parameters given to `getVectorInstrCost` are incorrect.
https://github.com/llvm/llvm-project/pull/148185
More information about the llvm-commits
mailing list