Bug 43741 - sh-elf ICEs for libstdc++-v3/src/ios_init.cc with -m2a
Summary: sh-elf ICEs for libstdc++-v3/src/ios_init.cc with -m2a
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-04-13 01:13 UTC by Kazumoto Kojima
Modified: 2010-04-17 03:54 UTC (History)
1 user (show)

See Also:
Host:
Target: sh-elf
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
a reduced test case (1.50 KB, text/plain)
2010-04-13 01:16 UTC, Kazumoto Kojima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kazumoto Kojima 2010-04-13 01:13:11 UTC
Unified build on sh-unknown-elf with enabling c++ ICEs during
compiling libstdc++-v3/src/ios_init.cc with -m2a.  It starts
to fail my recent change

r158208 | kkojima | 2010-04-12 07:59:36 +0900 (Mon, 12 Apr 2010) | 7 lines

	* config/sh/sh-protos.h (sh_legitimize_reload_address): Declare.
	* config/sh/sh.c: Include reload.h.
	(sh_legitimize_reload_address): New.
	* config/sh/sh.h (LEGITIMIZE_RELOAD_ADDRESS): Use
	sh_legitimize_reload_address.
Comment 1 Kazumoto Kojima 2010-04-13 01:16:35 UTC
Created attachment 20374 [details]
a reduced test case

xxx.ii: In constructor 'std::ios_base::Init::Init()':
xxx.ii:161:3: error: insn does not satisfy its constraints:
(insn 284 282 285 6 xxx.ii:113 (set (reg:SI 1 r1)
        (reg/f:SI 319)) 176 {movsi_ie} (nil))
xxx.ii:161:3: internal compiler error: in reload_cse_simplify_operands, at postreload.c:396

which shows that the pseudo register remains after reload.
The .ira rtl dump looks that sh_legitimize_reload_address makes
a too complex reload for this case.  I've confirmed the patch
below fix the above failure.  I'll apply it if it survives
the usual tests and doesn't make the code quality worse with
CSiBE tests.

--- ORIG/trunk/gcc/config/sh/sh.c	2010-04-12 09:52:36.000000000 +0900
+++ trunk/gcc/config/sh/sh.c	2010-04-13 08:55:31.000000000 +0900
@@ -9649,8 +9649,7 @@ sh_legitimize_reload_address (rtx *p, en
 	  || XEXP (*p, 0) == hard_frame_pointer_rtx))
     {
       rtx index_rtx = XEXP (*p, 1);
-      HOST_WIDE_INT offset = INTVAL (index_rtx), offset_base;
-      rtx sum;
+      HOST_WIDE_INT offset = INTVAL (index_rtx);
 
       if (TARGET_SH2A && mode == DFmode && (offset & 0x7))
 	{
@@ -9665,24 +9664,6 @@ sh_legitimize_reload_address (rtx *p, en
 		       BASE_REG_CLASS, Pmode, VOIDmode, 0, 0, opnum, type);
 	  goto win;
 	}
-      /* Instead of offset_base 128..131 use 124..127, so that
-	 simple add suffices.  */
-      if (offset > 127)
-	offset_base = ((offset + 4) & ~60) - 4;
-      else
-	offset_base = offset & ~60;
-      /* Sometimes the normal form does not suit DImode.  We could avoid
-	 that by using smaller ranges, but that would give less optimized
-	 code when SImode is prevalent.  */
-      if (offset_base != 0
-	  && GET_MODE_SIZE (mode) + offset - offset_base <= 64)
-	{
-	  sum = gen_rtx_PLUS (Pmode, XEXP (*p, 0), GEN_INT (offset_base));
-	  *p = gen_rtx_PLUS (Pmode, sum, GEN_INT (offset - offset_base));
-	  push_reload (sum, NULL_RTX, &XEXP (*p, 0), NULL,
-		       BASE_REG_CLASS, Pmode, VOIDmode, 0, 0, opnum, type);
-	  goto win;
-	}
     }
   /* We must re-recognize what we created before.  */
   else if (GET_CODE (*p) == PLUS
Comment 2 Kazumoto Kojima 2010-04-15 03:35:33 UTC
I've noticed that I applied a wrong patch at revision 158208 and
it causes the problematic reload in the failed case.  I'll fix it.

Comment 3 Kazumoto Kojima 2010-04-17 03:54:13 UTC
Fixed.