diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2019-10-17 06:46:51 -0400 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2019-10-20 23:49:42 -0400 |
| commit | 2ec73395b985a028062cc40faed6ace50be0c67d (patch) | |
| tree | d9ac2c63a0ebbf1fe8d7cdd695d95cc5ec2fecb7 /src/test/ui/iterators/iter-sum-overflow-debug.rs | |
| parent | 4592a9eb3f240cef2994ee76f6975c4946d4d269 (diff) | |
| download | rust-2ec73395b985a028062cc40faed6ace50be0c67d.tar.gz rust-2ec73395b985a028062cc40faed6ace50be0c67d.zip | |
Improve SimplifyLocals pass so it can remove unused consts
The `ConstProp` can cause many locals to be initialized to a constant value and then never read from. `ConstProp` can also evaluate ZSTs into constant values. Previously, many of these would be removed by other parts of the MIR optimization pipeline. However, evaluating ZSTs (especially `()`) into constant values defeated those parts of the optimizer and so in a2e3ed5c054b544df6ceeb9e612d39af819f4aae, I added a hack to `ConstProp` that skips evaluating ZSTs to avoid that regression. This commit changes `SimplifyLocals` so that it doesn't consider writes of const values to a local to be a use of that local. In doing so, `SimplifyLocals` is able to remove otherwise unused locals left behind by other optimization passes (`ConstProp` in particular).
Diffstat (limited to 'src/test/ui/iterators/iter-sum-overflow-debug.rs')
0 files changed, 0 insertions, 0 deletions
