[llvm] [SLP][NFC]Add a test with the incorrect spill cost calculation between operands (PR #192509)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 11:38:38 PDT 2026
https://github.com/alexey-bataev created https://github.com/llvm/llvm-project/pull/192509
None
>From 3c3d4ab009182cfdd5297a9807e06d7d13293618 Mon Sep 17 00:00:00 2001
From: Alexey Bataev <a.bataev at outlook.com>
Date: Thu, 16 Apr 2026 11:38:24 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.7
---
.../spillcost-call-between-operands.ll | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 llvm/test/Transforms/SLPVectorizer/AArch64/spillcost-call-between-operands.ll
diff --git a/llvm/test/Transforms/SLPVectorizer/AArch64/spillcost-call-between-operands.ll b/llvm/test/Transforms/SLPVectorizer/AArch64/spillcost-call-between-operands.ll
new file mode 100644
index 0000000000000..262977584a11d
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/AArch64/spillcost-call-between-operands.ll
@@ -0,0 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -S -passes=slp-vectorizer -mtriple=aarch64 -slp-threshold=-1 < %s | FileCheck %s
+
+declare void @external()
+
+define void @test(ptr %p, ptr %q, ptr %r) {
+; CHECK-LABEL: define void @test(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]], ptr [[R:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[A0:%.*]] = load double, ptr [[P]], align 8
+; CHECK-NEXT: [[PP1:%.*]] = getelementptr inbounds double, ptr [[P]], i64 1
+; CHECK-NEXT: [[A1:%.*]] = load double, ptr [[PP1]], align 8
+; CHECK-NEXT: call void @external()
+; CHECK-NEXT: [[B0:%.*]] = load double, ptr [[Q]], align 8
+; CHECK-NEXT: [[QQ1:%.*]] = getelementptr inbounds double, ptr [[Q]], i64 1
+; CHECK-NEXT: [[B1:%.*]] = load double, ptr [[QQ1]], align 8
+; CHECK-NEXT: [[S0:%.*]] = fadd double [[A0]], [[B0]]
+; CHECK-NEXT: [[S1:%.*]] = fadd double [[A1]], [[B1]]
+; CHECK-NEXT: call void @external()
+; CHECK-NEXT: store double [[S0]], ptr [[R]], align 8
+; CHECK-NEXT: [[RR1:%.*]] = getelementptr inbounds double, ptr [[R]], i64 1
+; CHECK-NEXT: store double [[S1]], ptr [[RR1]], align 8
+; CHECK-NEXT: ret void
+;
+entry:
+ %a0 = load double, ptr %p, align 8
+ %pp1 = getelementptr inbounds double, ptr %p, i64 1
+ %a1 = load double, ptr %pp1, align 8
+
+ call void @external()
+
+ %b0 = load double, ptr %q, align 8
+ %qq1 = getelementptr inbounds double, ptr %q, i64 1
+ %b1 = load double, ptr %qq1, align 8
+
+ %s0 = fadd double %a0, %b0
+ %s1 = fadd double %a1, %b1
+
+ call void @external()
+
+ store double %s0, ptr %r, align 8
+ %rr1 = getelementptr inbounds double, ptr %r, i64 1
+ store double %s1, ptr %rr1, align 8
+ ret void
+}
More information about the llvm-commits
mailing list