Skip to content

Commit fa200ce

Browse files
Rollup merge of #77525 - tmiasko:nrvo-2, r=jonas-schievink
Enable RenameReturnPlace MIR optimization on mir-opt-level >= 2 The destination propagation as currently implemented does not supersede the NRVO, e.g., the destination propagation never applies if either local has an address taken, while NRVO might. Additionally, the issue with failing assertions had been already resolved. Continue running both optimizations at mir-opt-level >= 2.
2 parents 5889cf3 + 59c2433 commit fa200ce

File tree

1 file changed

+0
-6
lines changed
  • compiler/rustc_mir/src/transform

1 file changed

+0
-6
lines changed

compiler/rustc_mir/src/transform/nrvo.rs

-6
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ impl<'tcx> MirPass<'tcx> for RenameReturnPlace {
3636
return;
3737
}
3838

39-
if tcx.sess.opts.debugging_opts.mir_opt_level >= 2 {
40-
// The `DestinationPropagation` pass runs at level 2, so this pass is redundant (and
41-
// fails some asserts).
42-
return;
43-
}
44-
4539
let returned_local = match local_eligible_for_nrvo(body) {
4640
Some(l) => l,
4741
None => {

0 commit comments

Comments
 (0)