https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92602
Bug ID: 92602
Summary: Failure in gcc.target/powerpc/bswap64-2.c
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: segher at gcc dot gnu.org
Target Milestone: ---
r278509 exposes this problem (the -fno-common patch). It causes global
variables to be accessed via an anchor.
But now fwprop1 does:
In insn 8, replacing
(mem/c:DI (reg/f:DI 119) [1 ul+0 S8 A64])
with (mem/c:DI (unspec:DI [
(symbol_ref:DI ("*.LANCHOR0") [flags 0x182])
(reg:DI 2 2)
] UNSPEC_TOCREL) [1 ul+0 S8 A64])
after which we have
(insn 6 3 8 2 (parallel [
(set (reg:DI 117 [ _1 ])
(bswap:DI (reg/v:DI 118 [ a ])))
(clobber (scratch:DI))
(clobber (scratch:DI))
]) "bswap64-2.c":10:45 156 {bswapdi2_reg}
(expr_list:REG_DEAD (reg/v:DI 118 [ a ])
(nil)))
(insn 8 6 0 2 (set (mem/c:DI (unspec:DI [
(symbol_ref:DI ("*.LANCHOR0") [flags 0x182])
(reg:DI 2 2)
] UNSPEC_TOCREL) [1 ul+0 S8 A64])
(reg:DI 117 [ _1 ])) "bswap64-2.c":10:43 622 {*movdi_internal64}
(expr_list:REG_DEAD (reg/f:DI 119)
(expr_list:REG_DEAD (reg:DI 117 [ _1 ])
(nil))))
and those can no longer be combined. Before the change, combine would
combine the reg-reg bswap and the simple indirect store to a bswapping
store.