Skip to content

[InlineCost] Never inline functions with incompatible target features - #205113

Merged
nikic merged 3 commits into
llvm:mainfrom
nikic:alwaysinline-features
Jul 6, 2026
Merged

nikic merged 3 commits into
llvm:mainfrom
nikic:alwaysinline-features

Conversation

@nikic

@nikic nikic commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

If inlining is unsound due to incompatible target feature attributes, we should not inline the call even if alwaysinline is set. This will likely result in a crash during instruction selection.

We tried this previously in d6f994a, but the change had to be reverted because the quality of our areInlineCompatible() hooks was very bad at the time, which resulted in inlining not happening in many cases where it was safe.

I think we're in a much better position now. Most notably, we now have a default areInlineCompatible() implementation that actually does something sensible (#117493), inlining compatibility for target features is now specified in TableGen (#205348). Various target-specific issues have been fixed as well, e.g. ARM's overly strict feature whitelist (#205763) and X86's overly conservative ABI compatibility checks (#205106).

@llvmorg-github-actions llvmorg-github-actions Bot added llvm:analysis Includes value tracking, cost tables and constant folding llvm:transforms labels Jun 22, 2026
@llvmorg-github-actions

llvmorg-github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

@llvm/pr-subscribers-llvm-analysis

@llvm/pr-subscribers-llvm-transforms

Author: Nikita Popov (nikic)

Changes

If inlining is unsound due to incompatible target feature attributes, we should not inline the call even if alwaysinline is set. This will likely result in a crash during instruction selection.

We tried this previously in d6f994a, but the change had to be reverted because the quality of our areInlineCompatible() hooks was very bad at the time, which resulted in inlining not happening in many cases where it was safe.

I think we're in a much better position now. Most notably, we now have a default areInlineCompatible() implementation that actually does something sensible (#117493), and various other target-specific issues have been fixed as well (e.g. ARM's outdated feature whitelist in #169337). The one remaining bit I'm aware of is the overly conservative ABI check on x86, which I'm fixing in #205106.


Full diff: https://github.com/llvm/llvm-project/pull/205113.diff

2 Files Affected:

  • (modified) llvm/lib/Analysis/InlineCost.cpp (+8-4)
  • (added) llvm/test/Transforms/Inline/X86/always-inline-features.ll (+32)
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index d975a93e9b1fd..8114dda51e54e 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -3089,9 +3089,7 @@ static bool functionsHaveCompatibleAttributes(
   // object, and always returns the same object (which is overwritten on each
   // GetTLI call). Therefore we copy the first result.
   auto CalleeTLI = GetTLI(*Callee);
-  return (IgnoreTTIInlineCompatible ||
-          TTI.areInlineCompatible(Caller, Callee)) &&
-         GetTLI(*Caller).areInlineCompatible(CalleeTLI,
+  return GetTLI(*Caller).areInlineCompatible(CalleeTLI,
                                              InlineCallerSupersetNoBuiltin) &&
          AttributeFuncs::areInlineCompatible(*Caller, *Callee);
 }
@@ -3214,6 +3212,13 @@ std::optional<InlineResult> llvm::getAttributeBasedInliningDecision(
                                      " address space");
     }
 
+  // Inlining into a function with less target features is unsound, so enforce
+  // this even if alwaysinline is used.
+  Function *Caller = Call.getCaller();
+  if (!IgnoreTTIInlineCompatible &&
+      !CalleeTTI.areInlineCompatible(Caller, Callee))
+    return InlineResult::failure("conflicting target features");
+
   // Calls to functions with always-inline attributes should be inlined
   // whenever possible.
   if (Call.hasFnAttr(Attribute::AlwaysInline)) {
@@ -3228,7 +3233,6 @@ std::optional<InlineResult> llvm::getAttributeBasedInliningDecision(
 
   // Never inline functions with conflicting attributes (unless callee has
   // always-inline attribute).
-  Function *Caller = Call.getCaller();
   if (!functionsHaveCompatibleAttributes(Caller, Callee, CalleeTTI, GetTLI))
     return InlineResult::failure("conflicting attributes");
 
diff --git a/llvm/test/Transforms/Inline/X86/always-inline-features.ll b/llvm/test/Transforms/Inline/X86/always-inline-features.ll
new file mode 100644
index 0000000000000..500356471c9ae
--- /dev/null
+++ b/llvm/test/Transforms/Inline/X86/always-inline-features.ll
@@ -0,0 +1,32 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -S -passes=inline < %s | FileCheck %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+; Even with alwaysinline, the callee cannot be inlined, because the target
+; features are incompatible. Inlining it would result in a selection failure
+; crash.
+
+define <16 x float> @caller(<16 x float> %a, <16 x float> %b) {
+; CHECK-LABEL: define <16 x float> @caller(
+; CHECK-SAME: <16 x float> [[A:%.*]], <16 x float> [[B:%.*]]) {
+; CHECK-NEXT:    [[RES:%.*]] = call <16 x float> @callee(<16 x float> [[A]], <16 x float> [[B]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:    ret <16 x float> [[RES]]
+;
+  %res = call <16 x float> @callee(<16 x float> %a, <16 x float> %b) alwaysinline
+  ret <16 x float> %res
+}
+
+define <16 x float> @callee(<16 x float> %a, <16 x float> %b) #0 {
+; CHECK-LABEL: define <16 x float> @callee(
+; CHECK-SAME: <16 x float> [[A:%.*]], <16 x float> [[B:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:    [[RES:%.*]] = call <16 x float> @llvm.x86.avx512.min.ps.512(<16 x float> [[A]], <16 x float> [[B]], i32 0)
+; CHECK-NEXT:    ret <16 x float> [[RES]]
+;
+  %res = call <16 x float> @llvm.x86.avx512.min.ps.512(<16 x float> %a, <16 x float> %b, i32 0)
+  ret <16 x float> %res
+}
+
+declare <16 x float> @llvm.x86.avx512.min.ps.512(<16 x float>, <16 x float>, i32 immarg)
+
+attributes #0 = { "target-features"="+avx512bw,+avx512dq,+avx512f" }

@antoniofrighetto antoniofrighetto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@boomanaiden154 boomanaiden154 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember there still being some issues from #65152. Quickly looking over the AArch64 areInlineCompatible implementation, it seems like we still couldn't handle the case where we want to inline a v7a callee into a v8a caller.

There were also some calls for missed inlining on always_inline due to mismatched target features to be a frontend error/warning in clang (#65205 (comment)), like we already do for some cases. My plan was to try out implementing the warning and see how much fallout there was on our codebase, but I haven't gotten around to it yet.

@nikic

nikic commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

I remember there still being some issues from #65152. Quickly looking over the AArch64 areInlineCompatible implementation, it seems like we still couldn't handle the case where we want to inline a v7a callee into a v8a caller.

I'll look into this one. I think that we may want to just completely ignore these ARM architecture features for inlining? As far as I can tell, these architecture features are not actually used for anything, they just exist to imply other features that matter (like HasVxxxOps).

There were also some calls for missed inlining on always_inline due to mismatched target features to be a frontend error/warning in clang (#65205 (comment)), like we already do for some cases. My plan was to try out implementing the warning and see how much fallout there was on our codebase, but I haven't gotten around to it yet.

I haven't looked very closely, but I think that one was just a bug in X86's areInlineCompatible? It shouldn't error in the frontend, because it's supposed to inline. The underlying issue (inline assembly affecting ABI checks) has been fixed.

So I'm a bit unclear on what warning you actually want to implement? Do you want to promote optimization remarks for always inline failures to compiler warnings?

@boomanaiden154

Copy link
Copy Markdown
Contributor

I'll look into this one. I think that we may want to just completely ignore these ARM architecture features for inlining? As far as I can tell, these architecture features are not actually used for anything, they just exist to imply other features that matter (like HasVxxxOps).

I don't think we can just completely ignore them. From my understanding, it would still be illegal to inline a function marked v8a into a function marked v7a for example, but I'm not an ARM expert.

I haven't looked very closely, but I think that one was just a bug in X86's areInlineCompatible? It shouldn't error in the frontend, because it's supposed to inline. The underlying issue (inline assembly affecting ABI checks) has been fixed.

Yes, the specific case there was already fixed in the X86 TTI implementation.

So I'm a bit unclear on what warning you actually want to implement? Do you want to promote optimization remarks for always inline failures to compiler warnings?

Yes, that was (the beginnings of) the idea. We already do it in some cases (where clang can directly see the attributes and that they are trivially incompatible). It would make diagnosing potential fallout from this change much easier. Although the implementation might be tricky because we probably don't want to diagnose things like ICP promoting always_inline functions with differing target attributes.

@nikic

nikic commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

I don't think we can just completely ignore them. From my understanding, it would still be illegal to inline a function marked v8a into a function marked v7a for example, but I'm not an ARM expert.

Yes, that's correct. However, this is already handled because arm-v8a will imply v8 (aka HasV8Ops) and a bunch of other features, and those features are what actually control backend behavior. And those features already implement the correct inlining semantics.

As far as I can tell, the arm-* arch features just seem to be a convenient name for a certain set of features.

@boomanaiden154

Copy link
Copy Markdown
Contributor

Yes, that's correct. However, this is already handled because arm-v8a will imply v8 (aka HasV8Ops) and a bunch of other features, and those features are what actually control backend behavior. And those features already implement the correct inlining semantics.

Ah, okay. In that case, just ignoring the arm-* features seems like a reasonable enough approach to me.

Comment thread llvm/lib/Analysis/InlineCost.cpp Resolved
@nikic

nikic commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor Author

The ARM issue has been fixed in #205763.

Now the only target with unnecessarily conservative inlining behavior left is PowerPC (edit: Will be fixed by #206938).

@nikic
nikic force-pushed the alwaysinline-features branch from f18c5ae to 40c9a43 Compare July 3, 2026 08:35
@nikic

nikic commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@boomanaiden154 Do you still have concerns about this change? The specific ARM issue is now fixed, and more generally #205348 and followups moved us away from ad-hoc areInlineCompatible() implementations towards centralized handling in TableGen. I think the situation here is about as good as it's going to get now.

I'd really like to land this before the LLVM 23 release branches.

@boomanaiden154 boomanaiden154 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

No objections on my end. It wouldn't hurt if frontends can emit a warning/error around this, but that's a nice to have that shouldn't block a correctness fix.

Thanks for pushing this through.

nikic added 3 commits July 6, 2026 08:51
If inlining is unsound due to incompatible target feature attributes,
we should not inline the call even if alwaysinline is set.
@nikic
nikic force-pushed the alwaysinline-features branch from 40c9a43 to 74e0633 Compare July 6, 2026 06:52
@nikic
nikic enabled auto-merge (squash) July 6, 2026 07:14
@nikic
nikic merged commit 7bdca28 into llvm:main Jul 6, 2026
11 of 12 checks passed
@nikic
nikic deleted the alwaysinline-features branch July 6, 2026 07:28
@llvm-ci

llvm-ci commented Jul 6, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/45219

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: CodeGenCoroutines/coro-elide.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/bin/clang -cc1 -internal-isystem /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /Users/buildbot/buildbot-root/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp -o - | /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp
# executed command: /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/bin/clang -cc1 -internal-isystem /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /Users/buildbot/buildbot-root/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp -o -
# note: command had no output on stdout or stderr
# executed command: /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp
# .---command stderr------------
# | �[1m/Users/buildbot/buildbot-root/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp:28:16: �[0m�[0;1;31merror: �[0m�[1mCHECK-NEXT: is not on the line after the previous match
�[0m# | �[1m�[0m// CHECK-NEXT: ret void
# | �[0;1;32m               ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:36:2: �[0m�[0;1;30mnote: �[0m�[1m'next' match was here
�[0m# | �[1m�[0m ret void
# | �[0;1;32m ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:25:7: �[0m�[0;1;30mnote: �[0m�[1mprevious match ended here
�[0m# | �[1m�[0mentry:
# | �[0;1;32m      ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:26:1: �[0m�[0;1;30mnote: �[0m�[1mnon-matching line after previous match is here
�[0m# | �[1m�[0m %0 = alloca [32 x i8], align 8
# | �[0;1;32m^
�[0m# | �[0;1;32m�[0m
# | Input file: <stdin>
# | Check file: /Users/buildbot/buildbot-root/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# | �[1m�[0m�[0;1;90m            1: �[0m�[1m�[0;1;46m; ModuleID = '/Users/buildbot/buildbot-root/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp' �[0m
# | �[0;1;90m            2: �[0m�[1m�[0;1;46msource_filename = "/Users/buildbot/buildbot-root/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp" �[0m
# | �[0;1;90m            3: �[0m�[1m�[0;1;46mtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" �[0m
# | �[0;1;90m            4: �[0m�[1m�[0;1;46mtarget triple = "x86_64-unknown-linux-gnu" �[0m
# | �[0;1;90m            5: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;90m            6: �[0m�[1m�[0;1;46m%NoopCoro.Frame = type { ptr, ptr } �[0m
# | �[0;1;90m            7: �[0m�[1m�[0;1;46m%struct.Task = type { %"struct.std::coroutine_handle.0" } �[0m
# | �[0;1;90m            8: �[0m�[1m�[0;1;46m%"struct.std::coroutine_handle.0" = type { %"struct.std::coroutine_handle" } �[0m
# | �[0;1;90m            9: �[0m�[1m�[0;1;46m%"struct.std::coroutine_handle" = type { ptr } �[0m
# | �[0;1;90m           10: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;90m           11: �[0m�[1m�[0;1;46m$_ZNSt14suspend_always13await_suspendESt16coroutine_handleIvE = comdat any �[0m
# | �[0;1;90m           12: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;90m           13: �[0m�[1m�[0;1;46m$_ZNSt16coroutine_handleIN4Task12promise_typeEE12from_addressEPv = comdat any �[0m
# | �[0;1;90m           14: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;90m           15: �[0m�[1m�[0;1;46m$_ZN4Task12promise_type12FinalAwaiter13await_suspendIS0_EESt16coroutine_handleIvES3_IT_E = comdat any �[0m
# | �[0;1;90m           16: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;90m           17: �[0m�[1m�[0;1;46m$_ZNKSt16coroutine_handleIvE7addressEv = comdat any �[0m
# | �[0;1;90m           18: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;90m           19: �[0m�[1m�[0;1;46m$_ZN4Task7Awaiter13await_suspendESt16coroutine_handleIvE = comdat any �[0m
...

@llvm-ci

llvm-ci commented Jul 6, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/36766

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang :: CodeGenCoroutines/coro-halo.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/clang -cc1 -internal-isystem /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp -o - | /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/clang -cc1 -internal-isystem /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp -o -
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp
# .---command stderr------------
# | /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp:103:11: error: CHECK: expected string not found in input
# | // CHECK: ret i32 1190
# |           ^
# | <stdin>:15:36: note: scanning from here
# | define dso_local noundef i32 @main() local_unnamed_addr #0 {
# |                                    ^
# | <stdin>:64:3: note: possible intended match here
# |  store i32 110, ptr %adder.spill.addr.i, align 4
# |   ^
# | 
# | Input file: <stdin>
# | Check file: /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |             10: $_ZNSt14suspend_always13await_suspendESt16coroutine_handleIvE = comdat any 
# |             11:  
# |             12: $_ZNSt16coroutine_handleIN9generatorIiE12promise_typeEE12from_addressEPv = comdat any 
# |             13:  
# |             14: ; Function Attrs: mustprogress norecurse nounwind 
# |             15: define dso_local noundef i32 @main() local_unnamed_addr #0 { 
# | check:103'0                                       {                            search range start (exclusive)
# | check:103'1                                                                    error: no match found in search range
# |             16: entry: 
# |             17:  %s = alloca %struct.generator, align 8 
# |             18:  %t = alloca %struct.generator, align 8 
# |             19:  %m = alloca %struct.generator, align 8 
# |             20:  %0 = alloca [48 x i8], align 8 
# |              .
# |              .
# |              .
# |             59:  store ptr @_Z3addIiE9generatorIT_ERS2_S1_.resume, ptr %0, align 8 
# |             60:  %destroy.addr.i14 = getelementptr inbounds nuw i8, ptr %0, i64 8 
# |             61:  store ptr @_Z3addIiE9generatorIT_ERS2_S1_.cleanup, ptr %destroy.addr.i14, align 8 
# |             62:  %ref.tmp.reload.addr.i15 = getelementptr inbounds nuw i8, ptr %0, i64 41 
...

@llvm-ci

llvm-ci commented Jul 6, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/33465

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang :: CodeGenCoroutines/coro-halo.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang -cc1 -internal-isystem /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp -o - | /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp
# executed command: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang -cc1 -internal-isystem /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp -o -
# executed command: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp
# .---command stderr------------
# | /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp:103:11: error: CHECK: expected string not found in input
# | // CHECK: ret i32 1190
# |           ^
# | <stdin>:15:36: note: scanning from here
# | define dso_local noundef i32 @main() local_unnamed_addr #0 {
# |                                    ^
# | <stdin>:64:3: note: possible intended match here
# |  store i32 110, ptr %adder.spill.addr.i, align 4
# |   ^
# | 
# | Input file: <stdin>
# | Check file: /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/CodeGenCoroutines/coro-halo.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |             10: $_ZNSt14suspend_always13await_suspendESt16coroutine_handleIvE = comdat any 
# |             11:  
# |             12: $_ZNSt16coroutine_handleIN9generatorIiE12promise_typeEE12from_addressEPv = comdat any 
# |             13:  
# |             14: ; Function Attrs: mustprogress norecurse nounwind 
# |             15: define dso_local noundef i32 @main() local_unnamed_addr #0 { 
# | check:103'0                                       {                            search range start (exclusive)
# | check:103'1                                                                    error: no match found in search range
# |             16: entry: 
# |             17:  %s = alloca %struct.generator, align 8 
# |             18:  %t = alloca %struct.generator, align 8 
# |             19:  %m = alloca %struct.generator, align 8 
# |             20:  %0 = alloca [48 x i8], align 8 
# |              .
# |              .
# |              .
# |             59:  store ptr @_Z3addIiE9generatorIT_ERS2_S1_.resume, ptr %0, align 8 
# |             60:  %destroy.addr.i14 = getelementptr inbounds nuw i8, ptr %0, i64 8 
# |             61:  store ptr @_Z3addIiE9generatorIT_ERS2_S1_.cleanup, ptr %destroy.addr.i14, align 8 
# |             62:  %ref.tmp.reload.addr.i15 = getelementptr inbounds nuw i8, ptr %0, i64 41 
...

@llvm-ci

llvm-ci commented Jul 6, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder llvm-clang-ubuntu-x-aarch64-pauthtest running on as-builder-11 while building llvm at step 9 "test-check-clang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/227/builds/3072

Here is the relevant piece of the build log for the reference
Step 9 (test-check-clang) failure: Test just built components: check-clang completed (failure)
******************** TEST 'Clang :: CodeGenCoroutines/coro-elide.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/build/bin/clang -cc1 -internal-isystem /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/build/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp -o - | /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/build/bin/FileCheck /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp
# executed command: /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/build/bin/clang -cc1 -internal-isystem /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/build/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp -o -
# executed command: /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/build/bin/FileCheck /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp
# .---command stderr------------
# | /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp:28:16: error: CHECK-NEXT: is not on the line after the previous match
# | // CHECK-NEXT: ret void
# |                ^
# | <stdin>:36:2: note: 'next' match was here
# |  ret void
# |  ^
# | <stdin>:25:7: note: previous match ended here
# | entry:
# |       ^
# | <stdin>:26:1: note: non-matching line after previous match is here
# |  %0 = alloca [32 x i8], align 8
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/buildbot/worker/as-builder-11/x-aarch64-pauthtest/llvm-project/clang/test/CodeGenCoroutines/coro-elide.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           20:  
# |           21: @NoopCoro.Frame.Const = private constant %NoopCoro.Frame { ptr @__NoopCoro_ResumeDestroy, ptr @__NoopCoro_ResumeDestroy }, no_sanitize_address, no_sanitize_hwaddress 
# |           22:  
# |           23: ; Function Attrs: mustprogress nounwind 
# |           24: define dso_local void @_Z7flowoffv() local_unnamed_addr #0 { 
# |           25: entry: 
# | next:28'0          {   search range start (exclusive)
# |           26:  %0 = alloca [32 x i8], align 8 
# |           27:  store ptr @"_ZZ7flowoffvENK3$_0clEv.resume", ptr %0, align 8 
# |           28:  %destroy.addr.i = getelementptr inbounds nuw i8, ptr %0, i64 8 
# |           29:  store ptr @"_ZZ7flowoffvENK3$_0clEv.cleanup", ptr %destroy.addr.i, align 8 
# |           30:  %ref.tmp5.reload.addr.i = getelementptr inbounds nuw i8, ptr %0, i64 25 
# |           31:  %__promise.reload.addr.i = getelementptr inbounds nuw i8, ptr %0, i64 16 
# |           32:  store ptr null, ptr %__promise.reload.addr.i, align 8, !tbaa !6 
# |           33:  %index.addr19.i = getelementptr inbounds nuw i8, ptr %0, i64 24 
# |           34:  store i1 false, ptr %index.addr19.i, align 8 
# |           35:  call fastcc void @"_ZZ7flowoffvENK3$_0clEv.__await_suspend_wrapper__await"(ptr nonnull %ref.tmp5.reload.addr.i, ptr nonnull %0) #9, !inline_history !9 
...

@llvm-ci

llvm-ci commented Jul 6, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder llvm-clang-ubuntu-x-aarch64-pac-ret running on as-builder-11 while building llvm at step 16 "test-check-clang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/229/builds/2746

Here is the relevant piece of the build log for the reference
Step 16 (test-check-clang) failure: Test just built components: check-clang completed (failure)
******************** TEST 'Clang :: CodeGenCoroutines/coro-halo.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/build/bin/clang -cc1 -internal-isystem /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/build/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/llvm-project/clang/test/CodeGenCoroutines/coro-halo.cpp -o - | /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/build/bin/FileCheck /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/llvm-project/clang/test/CodeGenCoroutines/coro-halo.cpp
# executed command: /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/build/bin/clang -cc1 -internal-isystem /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/build/lib/clang/23/include -nostdsysteminc -triple x86_64-unknown-linux-gnu -std=c++20 -O2 -emit-llvm /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/llvm-project/clang/test/CodeGenCoroutines/coro-halo.cpp -o -
# executed command: /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/build/bin/FileCheck /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/llvm-project/clang/test/CodeGenCoroutines/coro-halo.cpp
# .---command stderr------------
# | /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/llvm-project/clang/test/CodeGenCoroutines/coro-halo.cpp:103:11: error: CHECK: expected string not found in input
# | // CHECK: ret i32 1190
# |           ^
# | <stdin>:15:36: note: scanning from here
# | define dso_local noundef i32 @main() local_unnamed_addr #0 {
# |                                    ^
# | <stdin>:64:3: note: possible intended match here
# |  store i32 110, ptr %adder.spill.addr.i, align 4
# |   ^
# | 
# | Input file: <stdin>
# | Check file: /home/buildbot/worker/as-builder-11/x-aarch64-pac-ret/llvm-project/clang/test/CodeGenCoroutines/coro-halo.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |             10: $_ZNSt14suspend_always13await_suspendESt16coroutine_handleIvE = comdat any 
# |             11:  
# |             12: $_ZNSt16coroutine_handleIN9generatorIiE12promise_typeEE12from_addressEPv = comdat any 
# |             13:  
# |             14: ; Function Attrs: mustprogress norecurse nounwind 
# |             15: define dso_local noundef i32 @main() local_unnamed_addr #0 { 
# | check:103'0                                       {                            search range start (exclusive)
# | check:103'1                                                                    error: no match found in search range
# |             16: entry: 
# |             17:  %s = alloca %struct.generator, align 8 
# |             18:  %t = alloca %struct.generator, align 8 
# |             19:  %m = alloca %struct.generator, align 8 
# |             20:  %0 = alloca [48 x i8], align 8 
# |              .
# |              .
# |              .
# |             59:  store ptr @_Z3addIiE9generatorIT_ERS2_S1_.resume, ptr %0, align 8 
# |             60:  %destroy.addr.i14 = getelementptr inbounds nuw i8, ptr %0, i64 8 
# |             61:  store ptr @_Z3addIiE9generatorIT_ERS2_S1_.cleanup, ptr %destroy.addr.i14, align 8 
# |             62:  %ref.tmp.reload.addr.i15 = getelementptr inbounds nuw i8, ptr %0, i64 41 
...

boomanaiden154 added a commit that referenced this pull request Jul 7, 2026
…incompatible target features" (#208079)

Reverts #192142

Now that #205113 has landed, we
will not inline functions with incompatible target features, even if the
callee is marked `alwaysinline`, so we can promote calls to such
functions while also removing the extra complexity from ICP.
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Jul 7, 2026
…tions with incompatible target features" (#208079)

Reverts llvm/llvm-project#192142

Now that llvm/llvm-project#205113 has landed, we
will not inline functions with incompatible target features, even if the
callee is marked `alwaysinline`, so we can promote calls to such
functions while also removing the extra complexity from ICP.
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request Jul 7, 2026
…tions with incompatible target features" (#208079)

Reverts llvm/llvm-project#192142

Now that llvm/llvm-project#205113 has landed, we
will not inline functions with incompatible target features, even if the
callee is marked `alwaysinline`, so we can promote calls to such
functions while also removing the extra complexity from ICP.
llvm-upstream-sync Bot pushed a commit to sriyalamar/cpullvm-toolchain that referenced this pull request Jul 7, 2026
…tions with incompatible target features" (#208079)

Reverts llvm/llvm-project#192142

Now that llvm/llvm-project#205113 has landed, we
will not inline functions with incompatible target features, even if the
callee is marked `alwaysinline`, so we can promote calls to such
functions while also removing the extra complexity from ICP.
gandhi56 pushed a commit that referenced this pull request Jul 9, 2026
…incompatible target features" (#208079)

Reverts #192142

Now that #205113 has landed, we
will not inline functions with incompatible target features, even if the
callee is marked `alwaysinline`, so we can promote calls to such
functions while also removing the extra complexity from ICP.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 21, 2026
…rget-feature-rust-lang#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` rust-lang#2

This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
…#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2





This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 21, 2026
…rget-feature-rust-lang#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` rust-lang#2

This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
…#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2





This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
…#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2





This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 21, 2026
…rget-feature-rust-lang#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` rust-lang#2

This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
Rollup merge of #162460 - Jamesbarford:feat/inline-always+target-feature-#2, r=nikic,traviscross

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2

This is broadly a resurrection of `#[inline(always)] + #[target_feature(enable = "...")]`.

- Applies the `alwaysinline` attribute to the function definition.
- `version < LLVM23` downgrades to an `inline` hint.
- Remove the check for using [target features + inline always](compiler/rustc_codegen_ssa/src/codegen_attrs.rs)

This should now be sound thanks to
* llvm/llvm-project#205113
* llvm/llvm-project#209345

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

Reference PR; rust-lang/reference#2391

r? @RalfJung
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:analysis Includes value tracking, cost tables and constant folding llvm:transforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants