Skip to content

Fix setting inline hint based on InstanceDef::requires_inline#79106

Merged
bors merged 1 commit into
rust-lang:masterfrom
tmiasko:inline-hint
Nov 19, 2020
Merged

Fix setting inline hint based on InstanceDef::requires_inline#79106
bors merged 1 commit into
rust-lang:masterfrom
tmiasko:inline-hint

Conversation

@tmiasko

@tmiasko tmiasko commented Nov 16, 2020

Copy link
Copy Markdown
Contributor

For instances where InstanceDef::requires_inline is true, an attempt
is made to set an inline hint though a call to the inline function.
The attempt is ineffective, since all attributes will be usually removed
by the second call.

Fix the issue by applying the attributes only once, with user provided
attributes having a priority when provided.

Closes #79108.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @oli-obk

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 16, 2020
@jonas-schievink

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown
Collaborator

Awaiting bors try build completion

@bors

bors commented Nov 16, 2020

Copy link
Copy Markdown
Collaborator

⌛ Trying commit d21c26de759749074fa06ccb72acd35311920870 with merge 215cffaf2348b072fbf45e176795ee5c10645ea8...

@bors

bors commented Nov 16, 2020

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-actions
Build commit: 215cffaf2348b072fbf45e176795ee5c10645ea8 (215cffaf2348b072fbf45e176795ee5c10645ea8)

@rust-timer

Copy link
Copy Markdown
Collaborator

Queued 215cffaf2348b072fbf45e176795ee5c10645ea8 with parent f5230fb, future comparison URL.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking try commit (215cffaf2348b072fbf45e176795ee5c10645ea8): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-perf

For instances where `InstanceDef::requires_inline` is true, an attempt
is made to set an inline hint though a call to the `inline` function.
The attempt is ineffective, since all attributes will be usually removed
by the second call.

Fix the issue by applying the attributes only once, with user provided
attributes having a priority when provided.
@tmiasko

tmiasko commented Nov 17, 2020

Copy link
Copy Markdown
Contributor Author

The perf results look quite promising. This fixes a bug where inline hint was
intended to be set by default for some instances, but in fact wasn't. With a
fix, LLVM codegen takes longer, but the cost is recovered by rustc being
sligthly faster (-0.1% average instruction counts). The rutsc boostrap timings
are worse though with +1.7%.

@tmiasko tmiasko changed the title experiment: Add a hint based on InstanceDef::requires_inline unless overridden Fix setting inline hint based on InstanceDef::requires_inline Nov 17, 2020
@eddyb

eddyb commented Nov 17, 2020

Copy link
Copy Markdown
Contributor

LGTM, cc @nagisa @wesleywiser @alexcrichton

Comment thread src/test/codegen/inline-hint.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the intended behaviour here when requires_inline == true and inline != None?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If its not something that can happen, maybe bug!() it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires inline instances are mostly auto-generated. Closures are the exception, so it is possible but unlikely. As far as what should take priority, no idea what the intent was, if it was considered at all (although the order of calls would suggest respecting user provided attributes).

@oli-obk

oli-obk commented Nov 17, 2020

Copy link
Copy Markdown
Contributor

r? @nagisa

@nagisa

nagisa commented Nov 18, 2020

Copy link
Copy Markdown
Member

@bors r=nagisa,eddyb

@bors

bors commented Nov 18, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 4ea25da has been approved by nagisa,eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 18, 2020
@bors

bors commented Nov 18, 2020

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 4ea25da with merge d91d08d88d83f418d20b15d79d093c7d85644e96...

@bors

bors commented Nov 18, 2020

Copy link
Copy Markdown
Collaborator

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 18, 2020
@wesleywiser

Copy link
Copy Markdown
Member

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 18, 2020
@bors

bors commented Nov 18, 2020

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 4ea25da with merge 675f114...

@bors

bors commented Nov 19, 2020

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: nagisa,eddyb
Pushing 675f114 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 19, 2020
@bors bors merged commit 675f114 into rust-lang:master Nov 19, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 19, 2020
@tmiasko tmiasko deleted the inline-hint branch November 19, 2020 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InstanceDef::requires_inline does not result in an inline hint

10 participants