Skip to content

Inline {min,max}_value even in debug builds - #64941

Merged
bors merged 1 commit into
rust-lang:masterfrom
tesuji:inline-max_min_value
Oct 3, 2019
Merged

Inline {min,max}_value even in debug builds#64941
bors merged 1 commit into
rust-lang:masterfrom
tesuji:inline-max_min_value

Conversation

@tesuji

@tesujitesuji commented Oct 1, 2019

Copy link
Copy Markdown
Contributor

I think it is worth to inline {min,max}_value even in debug builds.
See this godbolt link: https://godbolt.org/z/-COkVS

@tesuji
tesujiforce-pushed the inline-max_min_value branch from a7dec48 to 3b49ab6CompareOctober 1, 2019 04:10
@Centril

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 Oct 1, 2019

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 3b49ab6 with merge 61430923b8b2f3e7565c7aa30a3eb96474641bd6...

@bors

bors commented Oct 1, 2019

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-azure
Build commit: 61430923b8b2f3e7565c7aa30a3eb96474641bd6 (61430923b8b2f3e7565c7aa30a3eb96474641bd6)

@rust-timer

Copy link
Copy Markdown
Collaborator

Queued 61430923b8b2f3e7565c7aa30a3eb96474641bd6 with parent 22bc9e1, future comparison URL.

@jonas-schievink

Copy link
Copy Markdown
Contributor

Isn't perf only measuring compiler performance (which is always built in release mode)?

@tesuji

Copy link
Copy Markdown
ContributorAuthor

So how can I measure debug build of compiler?

I saw this code generated from debug build (godbolt link: https://godbolt.org/z/9cpH6U)

core::num::<impl u32>::max_value:moveax,4294967295retexample::bar:pushraxcall core::num::<impl u32>::max_valuemov dword ptr [rsp+4],eaxmoveax, dword ptr [rsp+4]poprcxret

That code is generated from:

pubfnbar() -> u32{
u32::max_value()}

So I think max_value should always be inlined?

@tesujitesuji changed the title Experimental: Inline {min,max}_value even in debug buildsInline {min,max}_value even in debug buildsOct 2, 2019
@tesuji

Copy link
Copy Markdown
ContributorAuthor

r? @nnethercote (randomly assign)

@nnethercote

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Oct 3, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit 3b49ab6 has been approved by nnethercote

@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 3, 2019
@bors

bors commented Oct 3, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 3b49ab6 with merge aa84c93d98bab674e7b7953cc30dd70f6d4cd0c1...

Centril added a commit to Centril/rust that referenced this pull request Oct 3, 2019
…hercote
Inline `{min,max}_value` even in debug builds
I think it is worth to inline `{min,max}_value` even in debug builds.
See this godbolt link: https://godbolt.org/z/-COkVS
@CentrilCentril mentioned this pull request Oct 3, 2019
@Centril

Copy link
Copy Markdown
Contributor

@bors retry rolled up.

bors added a commit that referenced this pull request Oct 3, 2019
Rollup of 2 pull requests
Successful merges:
- #64941 (Inline `{min,max}_value` even in debug builds)
- #65002 (Update llvm-project submodule)
Failed merges:
r? @ghost
@bors
bors merged commit 3b49ab6 into rust-lang:masterOct 3, 2019
@bors

bors commented Oct 3, 2019

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #65045) made this pull request unmergeable. Please resolve the merge conflicts.

@borsbors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 3, 2019
@tesuji
tesuji deleted the inline-max_min_value branch October 3, 2019 10:18
@scottmcm

Copy link
Copy Markdown
Member

The godbolt example says to me to just stop using max_value(), not to add an attribute.

See also rust-lang/rfcs#2700

@tesuji

tesuji commented Oct 10, 2019

Copy link
Copy Markdown
ContributorAuthor

@scottmcm What do you think about that case in #64996 and #65016 ?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-authorStatus: This is awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@tesuji@Centril@rust-timer@bors@jonas-schievink@nnethercote@scottmcm