Skip to content

Commit 7a29818

Browse files
committed
Ignore inline(always) in unoptimized builds
1 parent d7bd9cd commit 7a29818

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)