https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620
Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |vmakarov at redhat dot com --- Comment #14 from Jeffrey A. Law <law at redhat dot com> --- Ilya, thanks for the Linux (well, non-Darwin) testcase. I think it shows very clearly that this is an IRA/LRA problem. If we look at the .ira dump we have: (insn/f 43 7 2 2 (parallel [ (set (reg:SI 88) (unspec:SI [ (const_int 0 [0]) ] UNSPEC_SET_GOT)) (clobber (reg:CC 17 flags)) ]) 679 {set_got} (expr_list:REG_UNUSED (reg:SI 88) (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_EQUIV (unspec:SI [ (const_int 0 [0]) ] UNSPEC_SET_GOT) (expr_list:REG_CFA_FLUSH_QUEUE (nil) (nil)))))) We assign r88 to %eax. Note the REG_UNUSED note. The validity of the REG_UNUSED note is debatable since there aren't any uses of r88 in the RTL, but we do have those "hidden uses" when we have reloads. Later in the .ira dump we have: (call_insn 13 12 14 2 (parallel [ (call (mem:QI (reg/v/f:SI 4 si [orig:87 f ] [87]) [0 *(__float128 (*<T311>) (__float128)) f_4(D) S1 A8]) (const_int 32 [0x20])) (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int 4 [0x4]))) ]) j.c:11 657 {*call_pop} (expr_list:REG_CALL_DECL (nil) (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil))) (nil)) [ ... ] (insn 21 18 22 3 (set (mem:TF (pre_dec:SI (reg/f:SI 7 sp)) [1 S16 A128]) (const_double:TF 1.0e+29 [0x0.a18f07d736b90be55p+97])) j.c:13 121 {*pushtf} (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil))) So IRA assigns r88 to %eax. Which makes sense given the raw RTL. As far as IRA can tell, r88 is just set in the SET_GOT insn and it never gets used. LRA turns that into: (insn/f 43 7 2 2 (parallel [ (set (reg:SI 0 ax [88]) (unspec:SI [ (const_int 0 [0]) ] UNSPEC_SET_GOT)) (clobber (reg:CC 17 flags)) ]) 679 {set_got} (expr_list:REG_EQUIV (unspec:SI [ (const_int 0 [0]) ] UNSPEC_SET_GOT) (expr_list:REG_CFA_FLUSH_QUEUE (nil) (nil)))) [ ... ] (call_insn 13 12 14 2 (parallel [ (call (mem:QI (reg/v/f:SI 4 si [orig:87 f ] [87]) [0 *(__float128 (*<T311>) (__float128)) f_4(D) S1 A8]) (const_int 32 [0x20])) (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int 4 [0x4]))) ]) j.c:11 657 {*call_pop} (expr_list:REG_CALL_DECL (nil) (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil))) (nil)) [ ... ] (insn 46 18 47 3 (set (reg:SI 0 ax [93]) (plus:SI (reg:SI 0 ax [88]) (const:SI (unspec:SI [ (symbol_ref/u:SI ("*.LC0") [flags 0x2]) ] UNSPEC_GOTOFF)))) j.c:13 213 {*leasi} (expr_list:REG_EQUAL (symbol_ref/u:SI ("*.LC0") [flags 0x2]) (nil))) (insn 47 46 21 3 (set (reg:TF 23 xmm2 [94]) (mem/u/c:TF (reg:SI 0 ax [93]) [1 S16 A128])) j.c:13 126 {*movtf_internal} (nil)) Which is obviously bogus because %eax is clobbered at insn 13 and thus won't have a useful value at insn 46. Officially assigning to Vlad...