about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-08-25 13:52:52 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-08-25 17:08:00 +0530
commit7963bbb08421c4c5483a33e908ca9375d14c9217 (patch)
tree7a56af3c72d7783aeaac91d04273b207771af447 /src/rustllvm/PassWrapper.cpp
parent5e69622e0edf9aaff2135e0566979b3c09cb2d87 (diff)
parent6b95606a136bad2109253e5e32cc13b7ecbbc49e (diff)
downloadrust-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