Drop REG_CROSSING_JUMP when converting to a conditional return

Richard Sandiford rsandifo@linux.vnet.ibm.com
Tue Jan 14 10:37:00 GMT 2014


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.  */



More information about the Gcc-patches mailing list