http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575
--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK, sched2 reorders:
(insn 762 761 765 50 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
(const_int 112 [0x70])) [17 MEM[(struct *)&bs + 8B]+0 S4 A64])
(const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273
90 {*movsi_internal}
(nil))
(insn 765 762 766 50 (set (mem:HI (reg/f:SI 7 sp) [49 S2 A16])
(reg/v:HI 1 dx [orig:232 v ] [232]))
../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal}
(expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232])
(expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
(nil))))
(insn 766 765 2326 50 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int -12 [0xfffffffffffffff4])))
(clobber (reg:CC 17 flags))
]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1}
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_ARGS_SIZE (const_int 28 [0x1c])
(nil))))
to
(insn 766 761 762 54 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int -12 [0xfffffffffffffff4])))
(clobber (reg:CC 17 flags))
]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1}
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_ARGS_SIZE (const_int 28 [0x1c])
(nil))))
(insn:TI 762 766 765 54 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
(const_int 124 [0x7c])) [17 MEM[(struct *)&bs + 8B]+0 S4 A64])
(const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273
90 {*movsi_internal}
(nil))
(insn 765 762 770 54 (set (mem:HI (plus:SI (reg/f:SI 7 sp)
(const_int 12 [0xc])) [49 S2 A16])
(reg/v:HI 1 dx [orig:232 v ] [232]))
../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal}
(expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232])
(expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
(nil))))
Here insn 765 gets adjusted for insn766 wihtout updating REG_ARGS_SIZE. I
guess it is because REG_ARGS_SIZE is supposed to sit on insn adjust the stack.
Insn 765 looks as follows:
(insn 762 761 763 50 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
(const_int 112 [0x70])) [17 MEM[(struct *)&bs + 8B]+0 S4 A64])
(const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273
90 {*movsi_internal}
(nil))
(insn 763 762 764 50 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int 16 [0x10])))
(clobber (reg:CC 17 flags))
]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1}
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_ARGS_SIZE (const_int 0 [0])
(nil))))
(insn 764 763 765 50 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int -12 [0xfffffffffffffff4])))
(clobber (reg:CC 17 flags))
]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1}
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_ARGS_SIZE (const_int 12 [0xc])
(nil))))
(insn 765 764 766 50 (set (mem:HI (pre_modify:SI (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int -4 [0xfffffffffffffffc]))) [49 S2 A16])
(reg/v:HI 1 dx [orig:232 v ] [232]))
../../../../libgo/go/encoding/binary/binary.go:273 71 {*pushhi2}
(expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232])
(expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
(nil))))
until CSA pass where it gets transformed as:
(insn 762 761 765 50 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
(const_int 112 [0x70])) [17 MEM[(struct *)&bs + 8B]+0 S4 A64])
(const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273
90 {*movsi_internal}
(nil))
(insn 765 762 766 50 (set (mem:HI (reg/f:SI 7 sp) [49 S2 A16])
(reg/v:HI 1 dx [orig:232 v ] [232]))
../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal}
(expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232])
(expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
(nil))))
My conclussion thus would be that CSA ought to remove the REG_ARGS_SIZE note
since it combines stack adjustment with call insn much earlier in the insn
stream:
(insn 749 746 750 50 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [6 S4 A32])
(mem/u/c:SI (plus:SI (reg:SI 3 bx)
(const:SI (unspec:SI [
(symbol_ref/i:SI ("__go_tdn_uint16") <var_decl
0x7ffff6f23850 __go_tdn_uint16>)
] UNSPEC_GOT))) [58 S4 A8]))
../../../../libgo/go/encoding/binary/binary.go:271 66 {*pushsi2}
(expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
(nil)))
(call_insn 750 749 2021 50 (call (mem:QI (symbol_ref:SI
("__go_check_interface_type") [flags 0x41] <function_decl 0x7ffff6fcf400
__go_check_interface_type>) [0 __go_check_interface_type S1 A8])
(const_int 16 [0x10]))
../../../../libgo/go/encoding/binary/binary.go:271 672 {*call}
(expr_list:REG_DEAD (reg:SI 3 bx)
(nil))
(expr_list:REG_DEP_TRUE (use (reg:SI 3 bx))
(nil)))