rust/src/librustc_trans
bors 1d5b758bab Auto merge of #35409 - eddyb:mir-storage-stmts, r=nikomatsakis
[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.
2016-08-14 12:28:48 -07:00
..
2016-08-03 15:08:47 +03:00
2016-08-03 15:08:47 +03:00
2016-08-03 15:08:47 +03:00
2016-08-03 15:08:47 +03:00
2016-08-03 15:08:47 +03:00
2016-08-03 15:08:47 +03:00
2016-08-04 07:31:06 +05:30
2016-08-03 15:08:47 +03:00
2016-08-03 15:08:47 +03:00

See the README.md in ../librustc.