]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/copy-prop/dead_stores_better.rs
Auto merge of #107443 - cjgillot:generator-less-query, r=compiler-errors
[rust.git] / tests / mir-opt / copy-prop / dead_stores_better.rs
1 // This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates
2 // that that pass enables this one to do more optimizations.
3
4 // unit-test: CopyProp
5 // compile-flags: -Zmir-enable-passes=+DeadStoreElimination
6
7 fn id<T>(x: T) -> T {
8     x
9 }
10
11 // EMIT_MIR dead_stores_better.f.CopyProp.after.mir
12 pub fn f(mut a: usize) -> usize {
13     let b = a;
14     a = 5;
15     a = b;
16     id(a)
17 }
18
19 fn main() {
20     f(0);
21 }