This is a SH regression on the 4.7 and trunk while building Webkit
(pre-processed file size is about 2.2Mb :-)

A far branch to a return rtx produces an ICE in
find_dead_or_set_registers at line resource.c:497:

next = JUMP_LABEL (this_jump_insn);
if (ANY_RETURN_P (next)) <- next is null
 next = NULL_RTX;

Turns out that JUMP_LABEL was not set after gen_return in
sh.c:gen_far_branch.

This patch fixes this. Tested for sh4-linux

OK for 4.7 and trunk ?

thanks

Christian
2012-07-19  Christian Bruel  <christian.br...@st.com>

	* config/sh/sh.c (gen_far_branch): Set JUMP_LABEL for return jumps.

Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c	(revision 189613)
+++ gcc/config/sh/sh.c	(working copy)
@@ -5304,6 +5304,7 @@
     }
   else
     jump = emit_jump_insn_after (gen_return (), insn);
+
   /* Emit a barrier so that reorg knows that any following instructions
      are not reachable via a fall-through path.
      But don't do this when not optimizing, since we wouldn't suppress the
@@ -5312,7 +5313,16 @@
   if (optimize)
     emit_barrier_after (jump);
   emit_label_after (bp->near_label, insn);
+
+  if (bp->far_label)
   JUMP_LABEL (jump) = bp->far_label;
+  else
+    {
+      rtx pat = PATTERN (jump);
+      gcc_assert (ANY_RETURN_P (pat));
+      JUMP_LABEL (jump) = pat;
+    }
+
   ok = invert_jump (insn, label, 1);
   gcc_assert (ok);
   

Reply via email to