I don't have much information yet but I wanted to file this so I don't lose track of it. With lra_remat turned on, we get a crash inside dl_main. 0x000000400080386c <dl_main+5604>: ldr x2, [x3,w0,uxtw #3] => 0x0000004000803870 <dl_main+5608>: ldrb w1, [x2,#788] (gdb) p $x2 $1 = 0
dl-deps.c is being miscompiled.
(In reply to Andrew Pinski from comment #1) > dl-deps.c is being miscompiled. Specifically _dl_map_object_deps.
It looks like dse is removing more stores when lra_remat is enable: (insn 538 537 2663 41 (set (mem/f:DI (plus:DI (reg/f:DI 1 x1 [581]) (const_int 16 [0x10])) [1 runp_409->next+0 S8 A128]) (const_int 0 [0])) dl-deps.c:283 42 {*movdi_aarch64} (nil)) That is for: newp->next = NULL; tail->next = newp; DSE (after reload) thinks tail->next is the same as the store to newp->next with LRA_REMAT turned on. **scanning insn=538 mem: (plus:DI (reg/f:DI 1 x1 [581]) (const_int 16 [0x10])) after canon_rtx address: (plus:DI (reg/f:DI 1 x1 [581]) (const_int 16 [0x10])) after cselib_expand address: (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) .... **scanning insn=539 mem: (plus:DI (reg/v/f:DI 2 x2 [orig:88 runp ] [88]) (const_int 16 [0x10])) after canon_rtx address: (plus:DI (reg/v/f:DI 2 x2 [orig:88 runp ] [88]) (const_int 16 [0x10])) after cselib_expand address: (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) after canon_rtx address: (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) varying cselib base=2:4287 offset = 16 processing cselib store [16..24) **scanning insn=539 mem: (plus:DI (reg/v/f:DI 2 x2 [orig:88 runp ] [88]) (const_int 16 [0x10])) after canon_rtx address: (plus:DI (reg/v/f:DI 2 x2 [orig:88 runp ] [88]) (const_int 16 [0x10])) after cselib_expand address: (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) after canon_rtx address: (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) varying cselib base=2:4287 offset = 16 processing cselib store [16..24)
Created attachment 33996 [details] the .i file
No the problem is LRA_REMAT thinks: (insn 2653 217 219 13 (set (reg/v/f:DI 3 x3 [orig:97 needed ] [97]) (mem/c:DI (plus:DI (reg/f:DI 29 x29) (const_int 152 [0x98])) [34 %sfp+-136 S8 A64])) dl-deps.c:224 42 {*movdi_aarch64} (nil)) Is really sp but it is not as sp has changed just a few instructions above: (insn 210 2652 214 13 (set (reg/f:DI 31 sp) (minus:DI (reg/f:DI 3 x3 [1110]) (reg:DI 1 x1 [485]))) dl-deps.c:224 218 {subdi3} (nil)) Meaning LRA_remat cannot think sp is a constant if alloca is ever used.
(In reply to Andrew Pinski from comment #4) > Created attachment 33996 [details] > the .i file Andrew, I'll start to work on this soon. Sorry for inconvenience introduced by LRA remat. pass.
Author: vmakarov Date: Tue Nov 18 00:14:25 2014 New Revision: 217683 URL: https://gcc.gnu.org/viewcvs?rev=217683&root=gcc&view=rev Log: 2014-11-17 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/63906 * lra-remat.c (operand_to_remat): Check SP and frame_pointer_required. Modified: trunk/gcc/ChangeLog trunk/gcc/lra-remat.c
Confirmed fixed.