-C inline-threshold is ignored by LLVM when optimizing for size, while llvm-args=-inline-threshold works #61088
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Complied with
-C opt-level=s -C inline-threshold=300
produces (same as just-C opt-level=s
)Complied with
-C opt-level=s -C llvm-args=-inline-threshold=300
produces(Godbolt link)
The cause appears to be that LLVM keeps using a separate inlining threshold from the "primary" one given by rustc on functions with
optsize
attribute, but only when it didn't receive-inline-threshold
itself.Fixing this seems to either require converting the rustc-received argument to LLVM commandline one, or constructing a custom
llvm::InlineParams
structure instead of using one of LLVM-provided helper functions?The text was updated successfully, but these errors were encountered: