diff options
| author | bors <bors@rust-lang.org> | 2023-01-09 11:59:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-09 11:59:51 +0000 |
| commit | 89e0576bd3aec2f1acf935b353900bd75742860b (patch) | |
| tree | 832426029cb2ca75232215aa44aba6a40a479954 /compiler/rustc_mir_transform/src | |
| parent | c54c8cbac882e149e04a9e1f2d146fd548ae30ae (diff) | |
| parent | 82f0973dd52d113666304802e9213b089e3211c6 (diff) | |
| download | rust-89e0576bd3aec2f1acf935b353900bd75742860b.tar.gz rust-89e0576bd3aec2f1acf935b353900bd75742860b.zip | |
Auto merge of #106340 - saethlin:propagate-operands, r=oli-obk
Always permit ConstProp to exploit arithmetic identities Fixes https://github.com/rust-lang/rust/issues/72751 Initially, I thought I would need to enable operand propagation then do something else, but actually https://github.com/rust-lang/rust/pull/74491 already has the fix for the issue in question! It looks like this optimization was put under MIR opt level 3 due to possible soundness/stability implications, then demoted further to MIR opt level 4 when MIR opt level 2 became associated with `--release`. Perhaps in the past we were doing CTFE on optimized MIR? We aren't anymore, so this optimization has no stability implications. r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index e384cfe1659..5c45abc5a17 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -655,11 +655,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { return None; } - if self.tcx.sess.mir_opt_level() >= 4 { - self.eval_rvalue_with_identities(rvalue, place) - } else { - self.use_ecx(|this| this.ecx.eval_rvalue_into_place(rvalue, place)) - } + self.eval_rvalue_with_identities(rvalue, place) } // Attempt to use algebraic identities to eliminate constant expressions |
