[llvm] Account for inline assembly instructions in inlining cost. (PR #146628)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 11:17:22 PDT 2025


================
@@ -0,0 +1,23 @@
+;; Test to verify that when callee has inline assembly, bumping up `-inline-asm-instr-cost` would block inlining.
+
+; RUN: opt < %s -passes=inline -S | FileCheck %s --check-prefixes=INLINE
+; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s --check-prefixes=INLINE
+; RUN: opt < %s -passes=inline -inline-asm-instr-cost=150 -S | FileCheck %s --check-prefixes=INLINE
+; RUN: opt < %s -passes='cgscc(inline)' -inline-asm-instr-cost=150 -S | FileCheck %s --check-prefixes=INLINE
+; RUN: opt < %s -passes=inline -inline-asm-instr-cost=300 -S | FileCheck %s --check-prefixes=NOINLINE
+; RUN: opt < %s -passes='cgscc(inline)' -inline-asm-instr-cost=300 -S | FileCheck %s --check-prefixes=NOINLINE
+
+; CHECK-LABEL: caller
----------------
mingmingl-llvm wrote:

nit: The FileCheck lines come with `--check-prefixes=<LABEL>` above, and `<LABEL>` are either INLINE or NOINLINE. Does `CHECK` at L10 and L11 get tested (e.g., making them mismatch cause test to fail)?

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


More information about the llvm-commits mailing list