[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
================
@@ -777,6 +786,42 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
addCost(SwitchCost);
}
+
+ // Parses the inline assembly argument to account for its cost. Inline
+ // assembly instructions incur higher costs for inlining since they cannot be
+ // analyzed and optimized.
+ void onInlineAsm(InlineAsm &Arg) override {
+ SmallVector<StringRef, 4> Fragments;
+ Arg.getAsmString().split(Fragments, "\n");
----------------
mingmingl-llvm wrote:
nit: use `InlineAsm::collectAsmStrs` at https://github.com/llvm/llvm-project/blob/988876cdd918d5b945a072a3d643b5fa22ae2917/llvm/lib/IR/InlineAsm.cpp#L63
https://github.com/llvm/llvm-project/pull/146628
More information about the llvm-commits
mailing list