cc @rust-lang/wg-mir-opt
if we have a basic block with no statements and just a return terminator, any other basic block that just gotos into that block could just as well call return itself. Or do we have some rule that we can only have a single return terminator per mir::Body?
Maybe we can generalize this and bubble any terminator of a statement-less block into its predecessor terminators iff that predecessor terminator is a goto.
As an example take
which is a basic block with no statements and just a
return terminator, and both predecessor blocks have a
goto to this block.
cc @rust-lang/wg-mir-opt
if we have a basic block with no statements and just a return terminator, any other basic block that just
gotos into that block could just as well callreturnitself. Or do we have some rule that we can only have a single return terminator permir::Body?Maybe we can generalize this and bubble any terminator of a statement-less block into its predecessor terminators iff that predecessor terminator is a
goto.As an example take
rust/src/test/mir-opt/issue-62289/rustc.test.ElaborateDrops.before.mir
Line 84 in 7b80539
returnterminator, and both predecessor blocks have agototo this block.