RFA: Fix debug address mode for TARGET_MEM_REF
diff mbox

Message ID CAFiYyc3FSJHkKu4St2B6bJn=zzxZSdN=FCgcXBgS_PsJgd9V8g@mail.gmail.com
State New
Headers show

Commit Message

Richard Biener Oct. 8, 2014, 11:02 a.m. UTC
On Wed, Oct 8, 2014 at 10:16 AM, Joern Rennecke
<joern.rennecke@embecosm.com> wrote:
> Trying to build avr2 strftime of avr-libc ICEs as we are trying to
> convert a PSImode address to HImode.  There is no reason to
> do this conversion in the first place - it is a case of failing to recognize
> the proper address space.
>
> The attached patch fixes this.
>
> Bootstrapped on i686-pc-linux-gnu.
>
> OK to apply?

The address-space of TARGET_MEM_REFs is in

TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0)))))

see TARGET_MEM_REF expansion or the MEM_REF handling.

It's unconditionally there, all the if()s in the existing code are bogus.

Thus

       if (op0 == NULL_RTX)

is pre-approved.

Thanks,
Richard.

Comments

Joern Rennecke Oct. 8, 2014, 12:37 p.m. UTC | #1
On 8 October 2014 12:02, Richard Biener <richard.guenther@gmail.com> wrote:
...
> -      if (POINTER_TYPE_P (TREE_TYPE (exp)))
> -       as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (exp)));
> -      else
> -       as = ADDR_SPACE_GENERIC;
> -
> +      as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))));
>        op0 = convert_debug_memory_address (targetm.addr_space.address_mode (as),
>                                           op0, as);
>        if (op0 == NULL_RTX)
>
> is pre-approved.

Thanks.  manually applied, avr2 strftime build confirmed,
i386-pc-linux-gnu bootstrapped, and checked in.

Patch
diff mbox

Index: cfgexpand.c
===================================================================
--- cfgexpand.c (revision 215917)
+++ cfgexpand.c (working copy)
@@ -3286,7 +3286,7 @@  expand_gimple_stmt_1 (gimple stmt)
@@ -3983,11 +3983,7 @@  expand_debug_expr (tree exp)
       if (!op0)
        return NULL;

-      if (POINTER_TYPE_P (TREE_TYPE (exp)))
-       as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (exp)));
-      else
-       as = ADDR_SPACE_GENERIC;
-
+      as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))));
       op0 = convert_debug_memory_address (targetm.addr_space.address_mode (as),
                                          op0, as);