public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Drop REG_CROSSING_JUMP when converting to a conditional return
@ 2014-01-14 10:37 Richard Sandiford
  2014-01-14 14:32 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-01-14 10:37 UTC (permalink / raw)
  To: gcc-patches

While experimenting with a patch to use conditional returns, I hit a case
where a conditional jump between hot and cold sections was being converted
into a conditional return.  The new jump still had the REG_CROSSING_JUMP
and later passes were confused by the combination of that and a return
JUMP_LABEL.

The jump is now returning directly from the current section rather than
crossing sections within the function, so I think we should just drop
the note.

Tested on s390x-linux-gnu with some local patches.  OK to install?

Thanks,
Richard


gcc/
	* jump.c (redirect_jump_2): Remove REG_CROSSING_JUMP notes when
	converting a conditional jump into a conditional return.

Index: gcc/jump.c
===================================================================
--- gcc/jump.c	2014-01-03 15:06:10.516727719 +0000
+++ gcc/jump.c	2014-01-14 10:27:13.224173269 +0000
@@ -1580,6 +1580,16 @@ redirect_jump_2 (rtx jump, rtx olabel, r
 	}
     }
 
+  /* Handle the case where we had a conditional crossing jump to a return
+     label and are now changing it into a direct conditional return.
+     The jump is no longer crossing in that case.  */
+  if (ANY_RETURN_P (nlabel))
+    {
+      note = find_reg_note (jump, REG_CROSSING_JUMP, NULL_RTX);
+      if (note)
+	remove_note (jump, note);
+    }
+
   if (!ANY_RETURN_P (olabel)
       && --LABEL_NUSES (olabel) == 0 && delete_unused > 0
       /* Undefined labels will remain outside the insn stream.  */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Drop REG_CROSSING_JUMP when converting to a conditional return
  2014-01-14 10:37 Drop REG_CROSSING_JUMP when converting to a conditional return Richard Sandiford
@ 2014-01-14 14:32 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2014-01-14 14:32 UTC (permalink / raw)
  To: gcc-patches, rsandifo

On 01/14/14 03:37, Richard Sandiford wrote:
> While experimenting with a patch to use conditional returns, I hit a case
> where a conditional jump between hot and cold sections was being converted
> into a conditional return.  The new jump still had the REG_CROSSING_JUMP
> and later passes were confused by the combination of that and a return
> JUMP_LABEL.
>
> The jump is now returning directly from the current section rather than
> crossing sections within the function, so I think we should just drop
> the note.
>
> Tested on s390x-linux-gnu with some local patches.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* jump.c (redirect_jump_2): Remove REG_CROSSING_JUMP notes when
> 	converting a conditional jump into a conditional return.
OK.

jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-14 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-14 10:37 Drop REG_CROSSING_JUMP when converting to a conditional return Richard Sandiford
2014-01-14 14:32 ` 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).