diff mbox

[SH] Fix ICE in find_dead_or_set_registers

Message ID 5007C796.4020900@st.com
State New
Headers show

Commit Message

Christian Bruel July 19, 2012, 8:38 a.m. UTC
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

Comments

Steven Bosscher July 19, 2012, 9:14 a.m. UTC | #1
On Thu, Jul 19, 2012 at 10:38 AM, Christian Bruel
<christian.bruel@st.com> wrote:
> This is a SH regression on the 4.7 and trunk while building Webkit
> (pre-processed file size is about 2.2Mb :-)

http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction

Ciao!
Steven
Kaz Kojima July 19, 2012, 10:35 a.m. UTC | #2
Christian Bruel <christian.bruel@st.com> wrote:
> 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 ?

> +  if (bp->far_label)
>    JUMP_LABEL (jump) = bp->far_label;

The 2nd line should be indented.  OK with that change.
Thanks for fixing this!

Regards,
	kaz
Christian Bruel July 19, 2012, 11:08 a.m. UTC | #3
On 07/19/2012 11:14 AM, Steven Bosscher wrote:
> On Thu, Jul 19, 2012 at 10:38 AM, Christian Bruel
> <christian.bruel@st.com> wrote:
>> This is a SH regression on the 4.7 and trunk while building Webkit
>> (pre-processed file size is about 2.2Mb :-)
> 
> http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction

The 2.2Mb file is already preprocessed and cleaned-up. It's c++ and the
many inlined functions are necessary to contribute to the final IR in
which the far jump exposes. Moving around code, by dichotomy or other
core removal techniques is not enough to reduce the problem in a small
enough test.

no problem to attach it to a new bugzilla before committing the fix.

Thanks

Christian


> 
> Ciao!
> Steven
>
Christian Bruel July 19, 2012, 11:20 a.m. UTC | #4
On 07/19/2012 12:35 PM, Kaz Kojima wrote:
> Christian Bruel <christian.bruel@st.com> wrote:
>> 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 ?
> 
>> +  if (bp->far_label)
>>    JUMP_LABEL (jump) = bp->far_label;
> 
> The 2nd line should be indented.  OK with that change.
> Thanks for fixing this!

thanks. the missing indentation was a diff artifact. I'll also add the
PR reference to the changelog entry

> 
> Regards,
> 	kaz
>
diff mbox

Patch

2012-07-19  Christian Bruel  <christian.bruel@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);