]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PR rtl-optimization/107182] Clear EDGE_CROSSING for jump->ret optimization
authorJeff Law <jeffreyalaw@gmail.com>
Tue, 11 Oct 2022 04:44:26 +0000 (00:44 -0400)
committerJeff Law <jeffreyalaw@gmail.com>
Tue, 11 Oct 2022 04:44:26 +0000 (00:44 -0400)
When turning a jump to a return into a return, we need to clear EDGE_CROSSING
of the fallthru edge to prevent a checking failure.

I considered not applying the transformation when the edge has EDGE_CROSSING
set, but it still seems like we ought to eliminate the unnecessary jump in
that case.

gcc/
PR rtl-optimization/107182
* cfgrtl.cc (fixup_reorder_chain): When optimizing a jump to a
return, clear EDGE_CROSSING on the appropriate edge.

gcc/cfgrtl.cc

index 281a432f6a6c151673c5532941184c41e8100a64..f31941a61f97dce69d0ce1c42d8f2d6cf0fe58a4 100644 (file)
@@ -4055,6 +4055,7 @@ fixup_reorder_chain (void)
          ret_label = PATTERN (ret);
          dest = EXIT_BLOCK_PTR_FOR_FN (cfun);
 
+         e_fall->flags &= ~EDGE_CROSSING;
          /* E_FALL->dest might become unreachable as a result of
             replacing the jump with a return.  So arrange to remove
             unreachable blocks.  */