> -----Original Message-----
> From: gcc-ow...@gcc.gnu.org [mailto:gcc-ow...@gcc.gnu.org] On Behalf Of Paulo
> Matos
> Sent: 19 December 2012 17:00
> To: gcc@gcc.gnu.org
> Subject: cselib_record_set breaks due to auto_inc_dec
> 
> Hi,
> 
> After pro and epilogue pass I have the following epilogue insn:
> (insn/f 20 19 21 2 (parallel [
>             (set (mem:DI (plus:SI (reg:SI 26 r26)
>                         (reg/f:SI 57 r57)) [0 S8 A8])
>                 (reg:DI 57 r57))
>             (set (reg/f:SI 57 r57)
>                 (plus:SI (reg:SI 26 r26)
>                     (reg/f:SI 57 r57)))
>         ]) bdra_main.i:2 -1
>      (expr_list:REG_DEAD (reg:SI 26 r26)
>         (expr_list:REG_FRAME_RELATED_EXPR (set (mem:DI (pre_modify:SI
> (reg/f:SI 57 r57)
>                         (plus:SI (reg/f:SI 57 r57)
>                             (const_int -8208 [0xffffffffffffdff0]))) [0 S8
> A8])
>                 (reg:DI 57 r57))
>             (nil))))
[snip]
> 
> Has anyone come across this before?
> 

To add to what I said before, a bit of investigation shows that for_each_rtx, 
called from for_each_inc_dec (in rtlanal.c), iterates over all expressions in 
insn, including (in the above case):
      (expr_list:REG_DEAD (reg:SI 26 r26)
         (expr_list:REG_FRAME_RELATED_EXPR (set (mem:DI (pre_modify:SI
 (reg/f:SI 57 r57)
                         (plus:SI (reg/f:SI 57 r57)
                             (const_int -8208 [0xffffffffffffdff0]))) [0 S8
 A8])
                 (reg:DI 57 r57))
             (nil))))

This doesn't look sensible to me (but I might be overlooking a reason why we 
want to do so) in the context of cselib_record_sets, however, I think 
cselib_record_sets should instead have the patch applied:
- for_each_inc_dec (&insn, cselib_record_autoinc_cb, &data);
+ for_each_inc_dec (&body, cselib_record_autoinc_cb, &data);

What do you think?

-- 
Paulo Matos

Reply via email to