[clang] [llvm] [AArch64][SME] Allow more inlining when SME attributes are incompatible. (PR #223393)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 07:53:13 PDT 2026
================
@@ -0,0 +1,49 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt -S -passes=inline -inlinedefault-threshold=1 < %s | FileCheck %s --check-prefixes=CHECK,TH1
+; RUN: opt -S -passes=inline -inlinedefault-threshold=25 < %s | FileCheck %s --check-prefixes=CHECK,TH25
+
+target triple = "aarch64"
+
+declare void @streaming_f() "aarch64_pstate_sm_enabled"
+
+define void @c() #0 "aarch64_pstate_sm_enabled" {
+; CHECK-LABEL: define void @c
+; CHECK-SAME: () #[[ATTR1:[0-9]+]] {
+; CHECK-NEXT: call void @streaming_f()
+; CHECK-NEXT: call void @streaming_f()
+; CHECK-NEXT: ret void
+;
+ call void @streaming_f()
+ call void @streaming_f()
+ ret void
+}
+
+; Don't inline the call to @c, as inlining a streaming function into a non-streaming function is considered incompatible.
+define void @b() #0 {
+; CHECK-LABEL: define void @b
+; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
+; CHECK-NEXT: call void @c()
+; CHECK-NEXT: ret void
+;
+ call void @c()
+ ret void
+}
+
+; Inline the call to @c in @a, as that avoids streaming mode changes.
+define void @a() #0 "aarch64_pstate_sm_enabled" {
+; TH1-LABEL: define void @a
+; TH1-SAME: () #[[ATTR1]] {
+; TH1-NEXT: call void @c()
+; TH1-NEXT: ret void
+;
+; TH25-LABEL: define void @a
+; TH25-SAME: () #[[ATTR1]] {
+; TH25-NEXT: call void @streaming_f()
+; TH25-NEXT: call void @streaming_f()
+; TH25-NEXT: ret void
+;
+ call void @b()
+ ret void
+}
+
+attributes #0 = { "target-features"="+sve,+sme" }
----------------
MacDue wrote:
nit: Move these to the run line
https://github.com/llvm/llvm-project/pull/223393
More information about the llvm-commits
mailing list