Uh oh!
There was an error while loading. Please reload this page.
[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}. - #35409
Conversation
rust-highfive
commented
Aug 6, 2016
(rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Make a helper function in cfg, since you’re constructing this multiple times manually.
This should become this.cfg.push_storage_live(source_info, temp);
arielb1
commented
Aug 6, 2016
Test please |
There was a problem hiding this comment.
Hmm, should this be restricted to base lvalues or something like that? Meh, I guess it's ok to use Lvalue<'tcx> here.
There was a problem hiding this comment.
Local would be great, but even then, it would not be applicable to ReturnPointer or args.
nikomatsakis
commented
Aug 8, 2016
Seems like a good use for @scottcarr's MIR testing framework. |
There was a problem hiding this comment.
Is there some way to refactor the arms? The only difference is End.call or Start.call, right?
EDIT: (I edited my original note which said "why not call lvalue_trans?" -- which we do not need)
There was a problem hiding this comment.
We need to do nothing if the local is not an Lvalue.
Using a method taking lvalue and the base::Lifetime would work, yeah.
OK so @eddyb convinced me that most of my concerns were moot. r=me modulo the following:
|
eddyb
commented
Aug 10, 2016
@bors r=nikomatsakis p=1 (if this gets into the nightly, it may fix a couple crates) |
bors
commented
Aug 10, 2016
📌 Commit 7def9f5 has been approved by |
bors
commented
Aug 10, 2016
⌛ Testing commit 7def9f5 with merge a5973b6... |
bors
commented
Aug 11, 2016
💔 Test failed - auto-linux-64-opt |
nikomatsakis
commented
Aug 11, 2016
Failures are valgrind failures: Could be real! |
eddyb
commented
Aug 11, 2016
@nikomatsakis I pinged @alexcrichton but I don't think he had time to look over them yet. |
eddyb
commented
Aug 11, 2016
@bors retry (hoping this is spurious) |
eddyb
commented
Aug 11, 2016
@bors p=0 |
bors
commented
Aug 13, 2016
☔ The latest upstream changes (presumably #35348) made this pull request unmergeable. Please resolve the merge conflicts. |
eddyb
commented
Aug 14, 2016
@bors r=nikomatsakis |
bors
commented
Aug 14, 2016
📌 Commit 02aec40 has been approved by |
bors
commented
Aug 14, 2016
⌛ Testing commit 02aec40 with merge 4d03edd... |
bors
commented
Aug 14, 2016
💔 Test failed - auto-linux-64-opt |
I |
eddyb
commented
Aug 14, 2016
Argh #26764 strikes again, this time libstd's |
eddyb
commented
Aug 14, 2016
@bors r=nikomatsakis |
bors
commented
Aug 14, 2016
📌 Commit 1bb1444 has been approved by |
eddyb
commented
Aug 14, 2016
@bors p=2 |
bors
commented
Aug 14, 2016
[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}.
Storage live ranges are tracked for all MIR variables and temporaries with a drop scope.
`StorageLive` is lowered to `llvm.lifetime.start` and `StorageDead` to `llvm.lifetime.end`.
There are some improvements possible here, such as:
* pack multiple storage liveness statements by using the index of first local + `u64` bitset
* enforce that locals are not directly accessed outside their storage live range
* shrink storage live ranges for never-borrowed locals to initialization -> last use
* emit storage liveness statements for *all* temporaries
* however, the remaining ones are *always* SSA immediates, so they'd be noop in MIR trans
* could have a flag on the temporary that its storage is irrelevant (a la C's old `register`)
* would also deny borrows if necessary
* this seems like an overcompliation and with packing & optimizations it may be pointless
Even in the current state, it helps stage2 `rustc` compile `boiler` without overflowing (see #35408).
A later addition fixes#26764 and closes#27372 by emitting `.section` directives for dylib metadata to avoid them being allocated into memory or read as `.note`. For this PR, those bugs were tripping valgrind.bors
commented
Aug 14, 2016
cuviper
commented
Aug 14, 2016
I don't know about the rest, but thanks for the incidental |
Storage live ranges are tracked for all MIR variables and temporaries with a drop scope.
StorageLiveis lowered tollvm.lifetime.startandStorageDeadtollvm.lifetime.end.There are some improvements possible here, such as:
u64bitsetregister)Even in the current state, it helps stage2
rustccompileboilerwithout overflowing (see #35408).A later addition fixes#26764 and closes#27372 by emitting
.sectiondirectives for dylib metadata to avoid them being allocated into memory or read as.note. For this PR, those bugs were tripping valgrind.