[llvm] [Inliner][TTI][AMDGPU] Add size growth TTI hook for unreachable-termed bb (PR #217014)
Janek van Oirschot via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 1 10:08:15 PDT 2026
================
@@ -0,0 +1,32 @@
+; RUN: opt -mtriple=amdgcn-amd-amdhsa -inline-call-penalty=0 -inline-threshold=1 -passes=inline -S < %s | FileCheck %s
+
+ at g = external global i32
+
+define void @small() {
+ store volatile i32 1, ptr @g
+ ret void
+}
+
+define void @big() {
+ store volatile i32 1, ptr @g
+ store volatile i32 2, ptr @g
+ store volatile i32 3, ptr @g
+ store volatile i32 4, ptr @g
+ store volatile i32 5, ptr @g
+ ret void
+}
+
+define void @caller_small() {
+; CHECK-LABEL: @caller_small
+; CHECK: store volatile i32 1, ptr @g
+; CHECK-NOT: call void @small
+ call void @small()
+ unreachable
+}
+
+define void @caller_big() {
+; CHECK-LABEL: @caller_big
+; CHECK: call void @big
----------------
JanekvO wrote:
It's not inlined for a different reason as it now goes through the cost analysis of the inliner which determines this shouldn't be inlined. The nuance as I have it as mental model: `allowSizeGrowth` can stop a call from being inlined but it cannot force a call to get inlined.
https://github.com/llvm/llvm-project/pull/217014
More information about the llvm-commits
mailing list