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`
This commit is contained in:
commit
89e0576bd3
4 changed files with 47 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue