diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-08-25 13:52:52 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-08-25 17:08:00 +0530 |
| commit | 7963bbb08421c4c5483a33e908ca9375d14c9217 (patch) | |
| tree | 7a56af3c72d7783aeaac91d04273b207771af447 /src/rustllvm/PassWrapper.cpp | |
| parent | 5e69622e0edf9aaff2135e0566979b3c09cb2d87 (diff) | |
| parent | 6b95606a136bad2109253e5e32cc13b7ecbbc49e (diff) | |
| download | rust-7963bbb08421c4c5483a33e908ca9375d14c9217.tar.gz rust-7963bbb08421c4c5483a33e908ca9375d14c9217.zip | |
Rollup merge of #35916 - eddyb:mir-no-dead-allocas, r=Aatch
rustc_trans: do not generate allocas for unused locals. This fixes a regression observed in a [`mio` test](https://travis-ci.org/carllerche/mio/jobs/152142886) which was referencing a 4MB `const` array. Even though MIR rvalue promotion would promote the borrow of the array, a dead temp was left behind. As the array doesn't have an immediate type, an `alloca` was generated for it, even though it had no uses. The fix is pretty dumb: assume that locals need to be borrowed or assigned before being used. And if it can't be used, it doesn't get an `alloca`, even if the type would otherwise demand it. This could change in the future, but all the MIR we generate now doesn't break that rule.
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
