Patchwork Fix ICE on loop over constant vector at -O

login
register
mail settings
Submitter Eric Botcazou
Date Dec. 11, 2012, 9:12 a.m.
Message ID <3439897.HpEVehmzsD@polaris>
Download mbox | patch
Permalink /patch/205140/
State New
Headers show

Comments

Eric Botcazou - Dec. 11, 2012, 9:12 a.m.
> ... so if would really be a pessimization doing that.  Of course handling
> CONST_DECL in for_each_index is indeed obvious - I just was curios if
> it was a missed-optimization opportunity as well.

It turns out that, for the same testcase, &CONST_DECL is generated on the MIPS 
and prepare_decl_rtl is trying to put an RTX on the CONST_DECL, hence ICE.

Tested on x86_64-suse-linux, applied on the mainline as obvious.  I agree that 
this is on the fringes of what we have to support, but we won't revisit it 
until the 4.9 development cycle.


2012-12-11  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-loop-ivopts.c (prepare_decl_rtl) <ADDR_EXPR>: Generate RTL
	only for a DECL which HAS_RTL_P.
Richard Guenther - Dec. 11, 2012, 9:55 a.m.
On Tue, Dec 11, 2012 at 10:12 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> ... so if would really be a pessimization doing that.  Of course handling
>> CONST_DECL in for_each_index is indeed obvious - I just was curios if
>> it was a missed-optimization opportunity as well.
>
> It turns out that, for the same testcase, &CONST_DECL is generated on the MIPS
> and prepare_decl_rtl is trying to put an RTX on the CONST_DECL, hence ICE.
>
> Tested on x86_64-suse-linux, applied on the mainline as obvious.  I agree that
> this is on the fringes of what we have to support, but we won't revisit it
> until the 4.9 development cycle.

Yeah - I plan to make CONST_DECLs much more present with getting rid of
&STRING_CST (making that &CONST_DECL of a string).  That solves one
weird special case we allow in the IL and also fixes wrong-code issues with LTO.

Richard.

>
> 2012-12-11  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * tree-ssa-loop-ivopts.c (prepare_decl_rtl) <ADDR_EXPR>: Generate RTL
>         only for a DECL which HAS_RTL_P.
>
>
> --
> Eric Botcazou

Patch

Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c	(revision 194382)
+++ tree-ssa-loop-ivopts.c	(working copy)
@@ -2806,7 +2806,7 @@  prepare_decl_rtl (tree *expr_p, int *ws,
 	   expr_p = &TREE_OPERAND (*expr_p, 0))
 	continue;
       obj = *expr_p;
-      if (DECL_P (obj) && !DECL_RTL_SET_P (obj))
+      if (DECL_P (obj) && HAS_RTL_P (obj) && !DECL_RTL_SET_P (obj))
         x = produce_memory_decl_rtl (obj, regno);
       break;