[clang] [Clang] Emit LLVM flatten attribute instead of per-callsite alwaysinline (PR #188615)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 19:05:41 PDT 2026


================
@@ -48,14 +60,26 @@ FN_ATTR void caller_streaming_compatible(void) __arm_streaming_compatible {
     STMT_ATTR fn_streaming_new_za();
     STMT_ATTR fn_streaming_new_zt0();
 }
-// CHECK-LABEL: void @caller_streaming_compatible()
-//  CHECK-NEXT: entry:
-//  CHECK-NEXT:   call void @fn
-//  CHECK-NEXT:   call void @was_inlined
-//  CHECK-NEXT:   call void @fn_streaming
-//  CHECK-NEXT:   call void @fn_locally_streaming
-//  CHECK-NEXT:   call void @fn_streaming_new_za
-//  CHECK-NEXT:   call void @fn_streaming_new_zt0
+// For flatten: TTI allows inlining fn(), fn_streaming_compatible(), fn_streaming(),
+// fn_locally_streaming() because they don't have incompatible ops. Only new_za/new_zt0 blocked.
----------------
efriedma-quic wrote:

My concern here is that it looks like we're doing more inlining with "flatten".  And I suspect we aren't doing the correct legality checks.  You're dropping the wouldInliningViolateFunctionCallABI check that was guarding those cases (see #116391).

Probably this is a bug in the inliner: the "flatten" LLVM IR attribute should be less aggressive.

CC @MacDue @sdesmalen-arm 

https://github.com/llvm/llvm-project/pull/188615


More information about the cfe-commits mailing list