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

Avoid unnecessary copies of arguments that are simple bindings #45380

Merged
merged 2 commits into from Oct 26, 2017

Conversation

Projects
None yet
10 participants
@dotdash
Contributor

dotdash commented Oct 19, 2017

Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.

Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.

@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Oct 19, 2017

Collaborator

r? @arielb1

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

Collaborator

rust-highfive commented Oct 19, 2017

r? @arielb1

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

@dotdash

This comment has been minimized.

Show comment
Hide comment
@dotdash

dotdash Oct 19, 2017

Contributor

@Mark-Simulacrum what do I need to get perf results for this?

Contributor

dotdash commented Oct 19, 2017

@Mark-Simulacrum what do I need to get perf results for this?

@Mark-Simulacrum

This comment has been minimized.

Show comment
Hide comment
@Mark-Simulacrum

Mark-Simulacrum Oct 19, 2017

Member

@bors try

Ping me when this completes, either here or on IRC and I'll run perf and get back to you.

Member

Mark-Simulacrum commented Oct 19, 2017

@bors try

Ping me when this completes, either here or on IRC and I'll run perf and get back to you.

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 19, 2017

Contributor

⌛️ Trying commit b7fa03a with merge 0d49100...

Contributor

bors commented Oct 19, 2017

⌛️ Trying commit b7fa03a with merge 0d49100...

bors added a commit that referenced this pull request Oct 19, 2017

Auto merge of #45380 - dotdash:arg_copies, r=<try>
Avoid unnecessary copies of arguments that are simple bindings

Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.

Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 19, 2017

Contributor

☀️ Test successful - status-travis
State: approved= try=True

Contributor

bors commented Oct 19, 2017

☀️ Test successful - status-travis
State: approved= try=True

@Mark-Simulacrum

This comment has been minimized.

Show comment
Hide comment
@Mark-Simulacrum
Member

Mark-Simulacrum commented Oct 19, 2017

Solid wins across the board timing-wise, though some of the memory use benchmarks increased by 5-15%: http://perf.rust-lang.org/compare.html?start=b7960878ba77124505aabe7dc99d0a898354c326&end=0d4910029c828c95069d88768882a0a46a19220d&stat=instructions%3Au.

@bluss bluss added the relnotes label Oct 20, 2017

@michaelwoerister

This comment has been minimized.

Show comment
Hide comment
@michaelwoerister

michaelwoerister Oct 23, 2017

Contributor

Those performance improvements look awesome, @dotdash!

Contributor

michaelwoerister commented Oct 23, 2017

Those performance improvements look awesome, @dotdash!

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Oct 24, 2017

Contributor

So this doesn't break simd_shuffle? Might be worth checking out why.

By that, I mean this code:

if is_shuffle && idx == 2 {
match *arg {
mir::Operand::Consume(_) => {
span_bug!(span, "shuffle indices must be constant");
}
mir::Operand::Constant(ref constant) => {
let val = self.trans_constant(&bcx, constant);
llargs.push(val.llval);
idx += 1;
continue;
}
}
}

Which is tested in https://github.com/rust-lang/rust/blob/a789fa0440214347e1bf6228fdb8fd36bf2f4520/src/test/run-pass/simd-intrinsic-generic-elements.rs

Contributor

arielb1 commented Oct 24, 2017

So this doesn't break simd_shuffle? Might be worth checking out why.

By that, I mean this code:

if is_shuffle && idx == 2 {
match *arg {
mir::Operand::Consume(_) => {
span_bug!(span, "shuffle indices must be constant");
}
mir::Operand::Constant(ref constant) => {
let val = self.trans_constant(&bcx, constant);
llargs.push(val.llval);
idx += 1;
continue;
}
}
}

Which is tested in https://github.com/rust-lang/rust/blob/a789fa0440214347e1bf6228fdb8fd36bf2f4520/src/test/run-pass/simd-intrinsic-generic-elements.rs

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Oct 24, 2017

Contributor

So there's a test, so let's

@bors r+

and if this bounces, we'll have our reason

Contributor

arielb1 commented Oct 24, 2017

So there's a test, so let's

@bors r+

and if this bounces, we'll have our reason

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 24, 2017

Contributor

📌 Commit ac99309 has been approved by arielb1

Contributor

bors commented Oct 24, 2017

📌 Commit ac99309 has been approved by arielb1

@@ -247,7 +247,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
} else {
let args: Vec<_> =
args.into_iter()
.map(|arg| unpack!(block = this.as_local_operand(block, arg)))
.map(|arg| {

This comment has been minimized.

@arielb1

arielb1 Oct 24, 2017

Contributor

Actually, can we have a comment here that says that we must copy the argument to a temp, because functions are allowed to mutate arguments passed to them by-reference on the ABI level? And add a similar comment to librustc/mir/mod.rs so that there is no confusion?

@arielb1

arielb1 Oct 24, 2017

Contributor

Actually, can we have a comment here that says that we must copy the argument to a temp, because functions are allowed to mutate arguments passed to them by-reference on the ABI level? And add a similar comment to librustc/mir/mod.rs so that there is no confusion?

This comment has been minimized.

@eddyb

eddyb Nov 13, 2017

Member

I'm not sure I like the resulting state from this... I think that Call should either take Locals instead of Operands, or trans should generate the copy out of non-immediate constants.

@eddyb

eddyb Nov 13, 2017

Member

I'm not sure I like the resulting state from this... I think that Call should either take Locals instead of Operands, or trans should generate the copy out of non-immediate constants.

This comment has been minimized.

@eddyb

eddyb Nov 13, 2017

Member

In fact, do we really want ABI concerns to shape MIR itself, as opposed to the ability to analyze it? I came back to this because I noticed that calls no longer had constants directly in them and thus copy propagation is incorrect into calls, and, without it, certain analyses would now need a bit more dataflow to even observe plain constants in function arguments.

@eddyb

eddyb Nov 13, 2017

Member

In fact, do we really want ABI concerns to shape MIR itself, as opposed to the ability to analyze it? I came back to this because I noticed that calls no longer had constants directly in them and thus copy propagation is incorrect into calls, and, without it, certain analyses would now need a bit more dataflow to even observe plain constants in function arguments.

This comment has been minimized.

@eddyb

eddyb Nov 14, 2017

Member

Talked this over with @arielb1 on IRC and I'm leaning towards "Operand::Constant is caller-owned, Operand::Consume is callee-owned", which would remove the temporaries for constant arguments and facilitate

Furthermore, we can skip some copies (for !Copy arguments) during MIR construction and have MIR borrowck enforce the soundness of Calls (lock the return destination and move in all the arguments).

@eddyb

eddyb Nov 14, 2017

Member

Talked this over with @arielb1 on IRC and I'm leaning towards "Operand::Constant is caller-owned, Operand::Consume is callee-owned", which would remove the temporaries for constant arguments and facilitate

Furthermore, we can skip some copies (for !Copy arguments) during MIR construction and have MIR borrowck enforce the soundness of Calls (lock the return destination and move in all the arguments).

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Oct 24, 2017

Contributor

And reading this again, I think that the "ABI detail" of function arguments belonging to the callee should be documented, at least at librustc/mir/mod.rs but probably elsewhere too.

@bors r-

Contributor

arielb1 commented Oct 24, 2017

And reading this again, I think that the "ABI detail" of function arguments belonging to the callee should be documented, at least at librustc/mir/mod.rs but probably elsewhere too.

@bors r-

@dotdash

This comment has been minimized.

Show comment
Hide comment
@dotdash

dotdash Oct 25, 2017

Contributor

So this doesn't break simd_shuffle? Might be worth checking out why.

QualifyConsts and PromoteConsts special case simd_shuffle, so constant promotion still kicks in there.

pub enum Candidate {
/// Borrow of a constant temporary.
Ref(Location),
/// Array of indices found in the third argument of
/// a call to one of the simd_shuffleN intrinsics.
ShuffleIndices(BasicBlock)
}

Contributor

dotdash commented Oct 25, 2017

So this doesn't break simd_shuffle? Might be worth checking out why.

QualifyConsts and PromoteConsts special case simd_shuffle, so constant promotion still kicks in there.

pub enum Candidate {
/// Borrow of a constant temporary.
Ref(Location),
/// Array of indices found in the third argument of
/// a call to one of the simd_shuffleN intrinsics.
ShuffleIndices(BasicBlock)
}

@dotdash

This comment has been minimized.

Show comment
Hide comment
@dotdash

dotdash Oct 25, 2017

Contributor

Added some comments to clarify the ownership of function arguments.

Contributor

dotdash commented Oct 25, 2017

Added some comments to clarify the ownership of function arguments.

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Oct 25, 2017

Contributor

@bors r+

Contributor

arielb1 commented Oct 25, 2017

@bors r+

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 25, 2017

Contributor

📌 Commit 1cc57cd has been approved by arielb1

Contributor

bors commented Oct 25, 2017

📌 Commit 1cc57cd has been approved by arielb1

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 25, 2017

Contributor

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

Contributor

bors commented Oct 25, 2017

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

@dotdash

This comment has been minimized.

Show comment
Hide comment
@dotdash

dotdash Oct 25, 2017

Contributor

@bors r=arielb1

Contributor

dotdash commented Oct 25, 2017

@bors r=arielb1

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 25, 2017

Contributor

📌 Commit f4e8432 has been approved by arielb1

Contributor

bors commented Oct 25, 2017

📌 Commit f4e8432 has been approved by arielb1

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 26, 2017

Contributor

⌛️ Testing commit f4e8432 with merge 1f11fb9...

Contributor

bors commented Oct 26, 2017

⌛️ Testing commit f4e8432 with merge 1f11fb9...

bors added a commit that referenced this pull request Oct 26, 2017

Auto merge of #45380 - dotdash:arg_copies, r=arielb1
Avoid unnecessary copies of arguments that are simple bindings

Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.

Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 26, 2017

Contributor

💔 Test failed - status-travis

Contributor

bors commented Oct 26, 2017

💔 Test failed - status-travis

@kennytm

This comment has been minimized.

Show comment
Hide comment
@kennytm

kennytm Oct 26, 2017

Member

i686-musl's codegen/fastcall-inreg.rs test failed, legit.

[00:52:29] failures:
[00:52:29] 
[00:52:29] ---- [codegen] codegen/fastcall-inreg.rs stdout ----
[00:52:29] 	
[00:52:29] error: verification with 'FileCheck' failed
[00:52:29] thread 'main' panicked at 'Some tests failed', /checkout/src/tools/compiletest/src/main.rs:329:21
[00:52:29] status: exit code: 1
[00:52:29] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/fastcall-inreg.ll" "/checkout/src/test/codegen/fastcall-inreg.rs"
[00:52:29] stdout:
[00:52:29] ------------------------------------------
[00:52:29] 
[00:52:29] ------------------------------------------
[00:52:29] stderr:
[00:52:29] ------------------------------------------
[00:52:29] /checkout/src/test/codegen/fastcall-inreg.rs:63:12: error: expected string not found in input
[00:52:29]  // CHECK: @f1(i32 inreg, i32 inreg, i32)
[00:52:29]            ^
[00:52:29] /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/fastcall-inreg.ll:1:1: note: scanning from here
[00:52:29] ; ModuleID = 'fastcall_inreg0-8787f43e282added376259c1adb08b80.rs'
[00:52:29] ^
[00:52:29] /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/fastcall-inreg.ll:7:37: note: possible intended match here
[00:52:29] define internal x86_fastcallcc void @f1(i32 inreg %arg0, i32 inreg %arg1, i32 %arg2) unnamed_addr #0 {
[00:52:29]                                     ^
[00:52:29] 
[00:52:29] ------------------------------------------
[00:52:29] 
[00:52:29] thread '[codegen] codegen/fastcall-inreg.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:2485:8
[00:52:29] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:52:29] 
[00:52:29] 
[00:52:29] failures:
[00:52:29]     [codegen] codegen/fastcall-inreg.rs
[00:52:29] 
[00:52:29] test result: �[31mFAILED�(B�[m. 47 passed; 1 failed; 5 ignored; 0 measured; 0 filtered out
[00:52:29] 
[00:52:29] 
[00:52:29] 
[00:52:29] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/i686-unknown-linux-musl/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/codegen" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen" "--stage-id" "stage2-i686-unknown-linux-musl" "--mode" "codegen" "--target" "i686-unknown-linux-musl" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--linker" "/musl-i686/bin/musl-gcc" "--host-rustcflags" "-Crpath -O" "--target-rustcflags" "-Crpath -O -Lnative=/checkout/obj/build/i686-unknown-linux-musl/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--llvm-version" "4.0.1\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:52:29] expected success, got: exit code: 101
[00:52:29] 
[00:52:29] 
[00:52:29] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target i686-unknown-linux-musl --target i586-unknown-linux-gnu
[00:52:29] Build completed unsuccessfully in 0:50:29
Member

kennytm commented Oct 26, 2017

i686-musl's codegen/fastcall-inreg.rs test failed, legit.

[00:52:29] failures:
[00:52:29] 
[00:52:29] ---- [codegen] codegen/fastcall-inreg.rs stdout ----
[00:52:29] 	
[00:52:29] error: verification with 'FileCheck' failed
[00:52:29] thread 'main' panicked at 'Some tests failed', /checkout/src/tools/compiletest/src/main.rs:329:21
[00:52:29] status: exit code: 1
[00:52:29] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/fastcall-inreg.ll" "/checkout/src/test/codegen/fastcall-inreg.rs"
[00:52:29] stdout:
[00:52:29] ------------------------------------------
[00:52:29] 
[00:52:29] ------------------------------------------
[00:52:29] stderr:
[00:52:29] ------------------------------------------
[00:52:29] /checkout/src/test/codegen/fastcall-inreg.rs:63:12: error: expected string not found in input
[00:52:29]  // CHECK: @f1(i32 inreg, i32 inreg, i32)
[00:52:29]            ^
[00:52:29] /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/fastcall-inreg.ll:1:1: note: scanning from here
[00:52:29] ; ModuleID = 'fastcall_inreg0-8787f43e282added376259c1adb08b80.rs'
[00:52:29] ^
[00:52:29] /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/fastcall-inreg.ll:7:37: note: possible intended match here
[00:52:29] define internal x86_fastcallcc void @f1(i32 inreg %arg0, i32 inreg %arg1, i32 %arg2) unnamed_addr #0 {
[00:52:29]                                     ^
[00:52:29] 
[00:52:29] ------------------------------------------
[00:52:29] 
[00:52:29] thread '[codegen] codegen/fastcall-inreg.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:2485:8
[00:52:29] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:52:29] 
[00:52:29] 
[00:52:29] failures:
[00:52:29]     [codegen] codegen/fastcall-inreg.rs
[00:52:29] 
[00:52:29] test result: �[31mFAILED�(B�[m. 47 passed; 1 failed; 5 ignored; 0 measured; 0 filtered out
[00:52:29] 
[00:52:29] 
[00:52:29] 
[00:52:29] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/i686-unknown-linux-musl/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/codegen" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen" "--stage-id" "stage2-i686-unknown-linux-musl" "--mode" "codegen" "--target" "i686-unknown-linux-musl" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--linker" "/musl-i686/bin/musl-gcc" "--host-rustcflags" "-Crpath -O" "--target-rustcflags" "-Crpath -O -Lnative=/checkout/obj/build/i686-unknown-linux-musl/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--llvm-version" "4.0.1\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:52:29] expected success, got: exit code: 101
[00:52:29] 
[00:52:29] 
[00:52:29] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target i686-unknown-linux-musl --target i586-unknown-linux-gnu
[00:52:29] Build completed unsuccessfully in 0:50:29

dotdash added some commits Oct 11, 2017

Avoid unnecessary copies of arguments that are simple bindings
Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.

Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
@dotdash

This comment has been minimized.

Show comment
Hide comment
@dotdash

dotdash Oct 26, 2017

Contributor

@bors r=arielb1

Contributor

dotdash commented Oct 26, 2017

@bors r=arielb1

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 26, 2017

Contributor

📌 Commit 8ad7c28 has been approved by arielb1

Contributor

bors commented Oct 26, 2017

📌 Commit 8ad7c28 has been approved by arielb1

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 26, 2017

Contributor

⌛️ Testing commit 8ad7c28 with merge 7f8fe16...

Contributor

bors commented Oct 26, 2017

⌛️ Testing commit 8ad7c28 with merge 7f8fe16...

bors added a commit that referenced this pull request Oct 26, 2017

Auto merge of #45380 - dotdash:arg_copies, r=arielb1
Avoid unnecessary copies of arguments that are simple bindings

Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.

Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 26, 2017

Contributor

💔 Test failed - status-appveyor

Contributor

bors commented Oct 26, 2017

💔 Test failed - status-appveyor

@kennytm

This comment has been minimized.

Show comment
Hide comment
@kennytm

kennytm Oct 26, 2017

Member

@bors retry

xsv's prop_frequency panicked on cargotest x86_64-pc-windows-msvc. According to #45348 (comment) this failure is spurious. cc @BurntSushi.

thread 'test_frequency::prop_frequency' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (CsvData { data: [[[239, 187, 191]], [[]]] })

Edit: Looks like this spurious bug has been fixed in BurntSushi/xsv@92de288. We just need to update our cargotest hash.

Member

kennytm commented Oct 26, 2017

@bors retry

xsv's prop_frequency panicked on cargotest x86_64-pc-windows-msvc. According to #45348 (comment) this failure is spurious. cc @BurntSushi.

thread 'test_frequency::prop_frequency' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (CsvData { data: [[[239, 187, 191]], [[]]] })

Edit: Looks like this spurious bug has been fixed in BurntSushi/xsv@92de288. We just need to update our cargotest hash.

kennytm added a commit to kennytm/rust that referenced this pull request Oct 26, 2017

cargotest: Update xsv.
This fixes a flaky test which caused spurious failures in rust-lang#45348 and rust-lang#45380

@kennytm kennytm referenced this pull request Oct 26, 2017

Merged

cargotest: Update xsv. #45550

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 26, 2017

Contributor

⌛️ Testing commit 8ad7c28 with merge b0b80f8...

Contributor

bors commented Oct 26, 2017

⌛️ Testing commit 8ad7c28 with merge b0b80f8...

bors added a commit that referenced this pull request Oct 26, 2017

Auto merge of #45380 - dotdash:arg_copies, r=arielb1
Avoid unnecessary copies of arguments that are simple bindings

Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.

Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 26, 2017

Contributor

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing b0b80f8 to master...

Contributor

bors commented Oct 26, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing b0b80f8 to master...

@bors bors merged commit 8ad7c28 into rust-lang:master Oct 26, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Oct 28, 2017

Member

This improved the debug compilation time of the regex crate by almost 8%, nice!

Member

alexcrichton commented Oct 28, 2017

This improved the debug compilation time of the regex crate by almost 8%, nice!

bors added a commit that referenced this pull request Oct 31, 2017

Auto merge of #45550 - kennytm:update-xsv, r=BurntSushi
cargotest: Update xsv.

This fixes a flaky test which caused spurious failures in #45348 and #45380.

bors added a commit that referenced this pull request Nov 17, 2017

Auto merge of #45996 - eddyb:even-mirer-1, r=arielb1
MIR: hide .rodata constants vs by-ref ABI clash in trans.

Back in #45380, constants were copied into locals during MIR creation to ensure that arguments ' memory can be used by the callee, if the constant is placed in `.rodata` and the ABI passes it by-ref.

However, there are several drawbacks (see #45380 (comment)), most importantly the complication of constant propagation (UB if a constant ends up in `Call` arguments) and inconveniencing analyses.

Instead, I've modified the `rustc_trans` implementation of calls to copy an `Operand::Constant` argument locally if it's not immediate, and added a test that segfaults without the copy.

cc @dotdash @arielb1

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Dec 3, 2017

Rollup merge of rust-lang#46462 - sinkuu:copyprop_reg2, r=arielb1
Fix CopyPropagation regression (2)

Remaining part of MIR copyprop regression by (I think) rust-lang#45380, which I missed in rust-lang#45753.

```rust
fn foo(mut x: i32) -> i32 {
    let y = x;
    x = 123; // `x` is assigned only once in MIR, but cannot be propagated to `y`
    y
}
```

So any assignment to an argument cannot be propagated.

@dotdash dotdash deleted the dotdash:arg_copies branch Jan 31, 2018

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