Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstanceDef::requires_inline does not result in an inline hint #79108

Closed
tmiasko opened this issue Nov 16, 2020 · 0 comments · Fixed by #79106
Closed

InstanceDef::requires_inline does not result in an inline hint #79108

tmiasko opened this issue Nov 16, 2020 · 0 comments · Fixed by #79106
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tmiasko
Copy link
Contributor

tmiasko commented Nov 16, 2020

The InstanceDef::requires_inline is described to return true if "this
instance is unconditionally marked with inline". In practice, the instance will
receive an inline hint if and only if the instance has any other user specified
inlining attributes.

For example, by default a closure will not receive an inline hint, but a
closure marked with #[inline(never)] counter-intuitively will (together with
noinline).

#![crate_type = "lib"]
#![feature(stmt_expr_attributes)]

pub fn f() {
    let a = || {};
    let b = #[inline(never)] || {};
    a();
    b();
}
; a::f::{{closure}}
; Function Attrs: nonlazybind uwtable
define internal void @"_ZN1a1f28_$u7b$$u7b$closure$u7d$$u7d$17hefe1f433f470c2abE"(%"[closure@a.rs:5:13: 5:18]"* noalias nonnull readonly align 1 %_1) unnamed_addr #0 {
start:
  ret void
}

; a::f::{{closure}}
; Function Attrs: inlinehint noinline nonlazybind uwtable
define internal void @"_ZN1a1f28_$u7b$$u7b$closure$u7d$$u7d$17h7b2e25d54194ec9cE"(%"[closure@a.rs:6:30: 6:35]"* noalias nonnull readonly align 1 %_1) unnamed_addr #1 {
start:
  ret void
}
@tmiasko tmiasko added the C-bug Category: This is a bug. label Nov 16, 2020
@jonas-schievink jonas-schievink added A-codegen Area: Code generation T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 16, 2020
@bors bors closed this as completed in 675f114 Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants