public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/80301] Sub-optimal code with an array of structs offsetted inside a struct global on x86/x86_64 at -O2
[not found] <bug-80301-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-05 1:39 ` pinskia at gcc dot gnu.org
2024-04-13 19:20 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-05 1:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80301
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We are able to do the 2->2 combine now (after r9-2064):
Trying 9 -> 10:
9: {r87:DI=r86:DI+0x2;clobber flags:CC;}
REG_DEAD r86:DI
REG_UNUSED flags:CC
10: flags:CCZ=cmp([r87:DI*0x8+`m'],r83:SI)
Failed to match this instruction:
(parallel [
(set (reg:CCZ 17 flags)
(compare:CCZ (mem:SI (plus:DI (mult:DI (reg:DI 86 [ indexD.2442 ])
(const_int 8 [0x8]))
(const:DI (plus:DI (symbol_ref:DI ("m") [flags 0x2]
<var_decl 0x7fda6f169cf0 m>)
(const_int 16 [0x10])))) [1
mD.2375.sD.2374[index_4(D)].aD.2372+0 S4 A64])
(reg:SI 83 [ <retval> ])))
(set (reg:DI 87)
(plus:DI (reg:DI 86 [ indexD.2442 ])
(const_int 2 [0x2])))
])
Failed to match this instruction:
(parallel [
(set (reg:CCZ 17 flags)
(compare:CCZ (mem:SI (plus:DI (mult:DI (reg:DI 86 [ indexD.2442 ])
(const_int 8 [0x8]))
(const:DI (plus:DI (symbol_ref:DI ("m") [flags 0x2]
<var_decl 0x7fda6f169cf0 m>)
(const_int 16 [0x10])))) [1
mD.2375.sD.2374[index_4(D)].aD.2372+0 S4 A64])
(reg:SI 83 [ <retval> ])))
(set (reg:DI 87)
(plus:DI (reg:DI 86 [ indexD.2442 ])
(const_int 2 [0x2])))
])
Successfully matched this instruction:
(set (reg:DI 87)
(plus:DI (reg:DI 86 [ indexD.2442 ])
(const_int 2 [0x2])))
Successfully matched this instruction:
(set (reg:CCZ 17 flags)
(compare:CCZ (mem:SI (plus:DI (mult:DI (reg:DI 86 [ indexD.2442 ])
(const_int 8 [0x8]))
(const:DI (plus:DI (symbol_ref:DI ("m") [flags 0x2] <var_decl
0x7fda6f169cf0 m>)
(const_int 16 [0x10])))) [1
mD.2375.sD.2374[index_4(D)].aD.2372+0 S4 A64])
(reg:SI 83 [ <retval> ])))
allowing combination of insns 9 and 10
original costs 4 + 13 = 17
replacement costs 4 + 13 = 17
modifying insn i2 9: r87:DI=r86:DI+0x2
deferring rescan insn with uid = 9.
modifying insn i3 10: flags:CCZ=cmp([r86:DI*0x8+const(`m'+0x10)],r83:SI)
REG_DEAD r86:DI
deferring rescan insn with uid = 10.
But then we don't sink the add into the conditional and do the combine there.
The code we get now is:
func(unsigned int):
movl %edi, %edx
movq %rdx, %rax
leaq 2(%rdx), %rcx
cmpl %edx, m+16(,%rdx,8)
je .L1
movl m+4(,%rcx,8), %eax
.L1:
ret
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug rtl-optimization/80301] Sub-optimal code with an array of structs offsetted inside a struct global on x86/x86_64 at -O2
[not found] <bug-80301-4@http.gcc.gnu.org/bugzilla/>
2021-09-05 1:39 ` [Bug rtl-optimization/80301] Sub-optimal code with an array of structs offsetted inside a struct global on x86/x86_64 at -O2 pinskia at gcc dot gnu.org
@ 2024-04-13 19:20 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80301
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Starting in GCC 11, we try to prop the add into the mem but then fail with:
```
cannot propagate from insn 9 into insn 10: would create an invalid MEM
cannot propagate from insn 9 into insn 16: would create an invalid MEM
```
I wonder if the mem address gets simplified or not ...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-13 19:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-80301-4@http.gcc.gnu.org/bugzilla/>
2021-09-05 1:39 ` [Bug rtl-optimization/80301] Sub-optimal code with an array of structs offsetted inside a struct global on x86/x86_64 at -O2 pinskia at gcc dot gnu.org
2024-04-13 19:20 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).