public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] [PR rtl-optimization/107182] Clear EDGE_CROSSING for jump->ret optimization
@ 2022-10-11  4:46 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2022-10-11  4:46 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]


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.


Bootstrapped and regression tested on x86_64.  Also did a profiled 
bootstrap and regression test on x86_64.


Installing on the trunk.


Jeff


[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1161 bytes --]

commit db24bdc743cf23ea12d2dcf8254d86ab366bb46d
Author: Jeff Law <jeffreyalaw@gmail.com>
Date:   Tue Oct 11 00:44:26 2022 -0400

    [PR rtl-optimization/107182] Clear EDGE_CROSSING for jump->ret optimization
    
    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.

diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc
index 281a432f6a6..f31941a61f9 100644
--- a/gcc/cfgrtl.cc
+++ b/gcc/cfgrtl.cc
@@ -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.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-11  4:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-11  4:46 [committed] [PR rtl-optimization/107182] Clear EDGE_CROSSING for jump->ret optimization Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).