Skip to content

Rollup of 6 pull requests - #67220

Merged
bors merged 15 commits into
rust-lang:masterfrom
Centril:rollup-n3u9wd5
Dec 11, 2019
Merged

Rollup of 6 pull requests#67220
bors merged 15 commits into
rust-lang:masterfrom
Centril:rollup-n3u9wd5

Conversation

@Centril

Copy link
Copy Markdown
Contributor

Successful merges:

Failed merges:

r? @ghost

Krishna Sai Veera Reddyand others added 15 commits November 29, 2019 15:22
Casting the booleans to `i8`s and converting their difference
into `Ordering` generates better assembly than casting them to
`u8`s and comparing them.
We now only propagate a scalar pair if the Rvalue is a tuple with two
scalars. This for example avoids propagating a (u8, u8) value when
Rvalue has type `((), u8, u8)` (see the regression test). While this is
a correct thing to do, implementation is tricky and will be done later.
Fixesrust-lang#66971Fixesrust-lang#66339Fixesrust-lang#67019
…-ord-optimization, r=sfackler
Optimize Ord trait implementation for bool
Casting the booleans to `i8`s and converting their difference into `Ordering` generates better assembly than casting them to `u8`s and comparing them.
Fixesrust-lang#66780
#### Comparison([Godbolt link](https://rust.godbolt.org/z/PjBpvF))
##### Old assembly:
```asm
example::boolean_cmp:
mov ecx, edi
xor ecx, esi
test esi, esi
mov eax, 255
cmove eax, ecx
test edi, edi
cmovne eax, ecx
ret
```
##### New assembly:
```asm
example::boolean_cmp:
mov eax, edi
sub al, sil
ret
```
##### Old LLVM-MCA statistics:
```
Iterations: 100
Instructions: 800
Total Cycles: 234
Total uOps: 1000
Dispatch Width: 6
uOps Per Cycle: 4.27
IPC: 3.42
Block RThroughput: 1.7
```
##### New LLVM-MCA statistics:
```
Iterations: 100
Instructions: 300
Total Cycles: 110
Total uOps: 500
Dispatch Width: 6
uOps Per Cycle: 4.55
IPC: 2.73
Block RThroughput: 1.0
```
Fix constant propagation for scalar pairs
We now only propagate a scalar pair if the Rvalue is a tuple with two scalars. This for example avoids propagating a (u8, u8) value when Rvalue has type `((), u8, u8)` (see the regression test). While this is a correct thing to do, implementation is tricky and will be done later.
Fixesrust-lang#66971Fixesrust-lang#66339Fixesrust-lang#67019
Add options to --extern flag.
This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude.
```text
--extern priv:mylib=/path/to/libmylib.rlib
--extern noprelude:alloc=/path/to/liballoc.rlib
```
`noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates.
This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on rust-lang#54020, and can be used in the future to replace and simplify some of the Makefile tests.
…=oli-obk
Ensure that panicking in constants eventually errors
based on rust-lang#67134closesrust-lang#66975
r? @oli-obk
@Centril

Copy link
Copy Markdown
ContributorAuthor

@bors r+ p=6 rollup=never

@bors

bors commented Dec 11, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit f6ceef5 has been approved by Centril

@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Dec 11, 2019
@CentrilCentril added the rollup A PR which is a rollup label Dec 11, 2019
@Centril

Copy link
Copy Markdown
ContributorAuthor

@bors p=2000

@bors

bors commented Dec 11, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit f6ceef5 with merge 033662d...

bors added a commit that referenced this pull request Dec 11, 2019
Rollup of 6 pull requests
Successful merges:
- #66881 (Optimize Ord trait implementation for bool)
- #67015 (Fix constant propagation for scalar pairs)
- #67074 (Add options to --extern flag.)
- #67164 (Ensure that panicking in constants eventually errors)
- #67174 (Remove `checked_add` in `Layout::repeat`)
- #67205 (Make `publish_toolstate.sh` executable)
Failed merges:
r? @ghost
@bors

bors commented Dec 11, 2019

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-azure
Approved by: Centril
Pushing 033662d to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Dec 11, 2019
@bors
bors merged commit f6ceef5 into rust-lang:masterDec 11, 2019
@Centril
Centril deleted the rollup-n3u9wd5 branch December 11, 2019 12:30
@borsbors mentioned this pull request Dec 11, 2019
@eddyb

Copy link
Copy Markdown
Contributor

Before I forget about it, I think something in this rollup caused a noticeable regression.
My initial guess was #67015, but it might not be that, according to #67015 (comment).

cc @rust-lang/wg-compiler-performance

@nikomatsakis

Copy link
Copy Markdown
Contributor

Should we file an issue to track that ?

@nnethercote

Copy link
Copy Markdown
Contributor

@oli-obk: Could #67164 have caused the regression?

@krishna-veerareddy: Could #66881 have cause the regression?

@ehuss: Could #67074 have caused the regression?

#67174 and #67205 seem very unlikely to be the cause.

I just tried to work out which commit caused the problem but failed; every revision I tried (even blatantly pre-merge ones) had the same post-regression numbers on ctfe-stress-4. Not sure what I'm doing wrong.

@krishna-veerareddy

Copy link
Copy Markdown
Contributor

@nnethercote Hey sorry for the late response. It's unlikely that 66881 could have caused a regression since it has to do with boolean comparision which isn't used quite often and if anything the fix should have reduced the instruction count but I could be wrong. Is this still an unresolved issue?

@oli-obk

Copy link
Copy Markdown
Contributor

It could have been caused by #67164 since we now produce some code for dead code that would otherwise never have been emitted to MIR. We can likely fix this via #67191 because then we can revert the commit.

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

Labels

merged-by-borsThis PR was explicitly merged by bors.rollupA PR which is a rollupS-waiting-on-borsStatus: 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.

12 participants

@Centril@bors@eddyb@nikomatsakis@nnethercote@krishna-veerareddy@oli-obk@osa1@kraai@ehuss@matthewjasper@JohnTitor