> ... 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 <ebotca...@adacore.com>
* tree-ssa-loop-ivopts.c (prepare_decl_rtl) <ADDR_EXPR>: Generate RTL
only for a DECL which HAS_RTL_P.
--
Eric Botcazou
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;