Skip to content

Commit 393ef12

Browse files
committed
Auto merge of rust-lang#121417 - saethlin:no-opt-no-inline, r=<try>
[perf experiment] Ignore inline(always) in unoptimized builds Yes I know we have a codegen test for this. But based on this perf run I'm concerned this is having unexpected perf implications so I want to measure what they are: rust-lang#121369 (comment) r? `@ghost`
2 parents d7bd9cd + 7a29818 commit 393ef12

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_codegen_llvm/src/attributes.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ fn inline_attr<'ll>(cx: &CodegenCx<'ll, '_>, inline: InlineAttr) -> Option<&'ll
4141
}
4242
match inline {
4343
InlineAttr::Hint => Some(AttributeKind::InlineHint.create_attr(cx.llcx)),
44-
InlineAttr::Always => Some(AttributeKind::AlwaysInline.create_attr(cx.llcx)),
44+
InlineAttr::Always => {
45+
if matches!(cx.sess().opts.optimize, OptLevel::No) {
46+
Some(AttributeKind::InlineHint.create_attr(cx.llcx))
47+
} else {
48+
Some(AttributeKind::AlwaysInline.create_attr(cx.llcx))
49+
}
50+
}
4551
InlineAttr::Never => {
4652
if cx.sess().target.arch != "amdgpu" {
4753
Some(AttributeKind::NoInline.create_attr(cx.llcx))

0 commit comments

Comments
 (0)