[Bug rtl-optimization/110240] Unnecessary register move in indexed swap routine
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 13 19:16:16 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110240
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-06-13
Status|UNCONFIRMED |NEW
Component|target |rtl-optimization
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed (though it is not exactly a target specific issue).
REE transforms:
(insn 7 4 8 2 (set (reg:SI 0 ax [orig:82 _1 ] [82])
(mem:SI (reg/v/f:DI 4 si [orig:93 b ] [93]) [1 *b_13(D)+0 S4 A32]))
"/app/example.cpp":3:10 91 {*movsi_internal}
(nil))
(insn 8 7 9 2 (set (reg:SI 1 dx [orig:87 _6 ] [87])
(mem:SI (plus:DI (reg/v/f:DI 4 si [orig:93 b ] [93])
(const_int 4 [0x4])) [1 MEM[(unsigned int *)b_13(D) + 4B]+0 S4
A32])) "/app/example.cpp":3:20 91 {*movsi_internal}
(nil))
(insn 9 8 10 2 (set (reg:DI 2 cx [orig:94 _1 ] [94])
(zero_extend:DI (reg:SI 0 ax [orig:82 _1 ] [82])))
"/app/example.cpp":3:10 159 {*zero_extendsidi2}
(nil))
(insn 10 9 11 2 (set (reg:DI 36 r8 [orig:95 _6 ] [95])
(zero_extend:DI (reg:SI 1 dx [orig:87 _6 ] [87])))
"/app/example.cpp":3:20 159 {*zero_extendsidi2}
(nil))
Into:
(insn 7 4 28 2 (set (reg:DI 2 cx)
(zero_extend:DI (mem:SI (reg/v/f:DI 4 si [orig:93 b ] [93]) [1
*b_13(D)+0 S4 A32]))) "/app/example.cpp":3:10 159 {*zero_extendsidi2}
(nil))
(insn 28 7 8 2 (set (reg:DI 0 ax)
(reg:DI 2 cx)) "/app/example.cpp":3:10 -1
(nil))
(insn 8 28 29 2 (set (reg:DI 36 r8)
(zero_extend:DI (mem:SI (plus:DI (reg/v/f:DI 4 si [orig:93 b ] [93])
(const_int 4 [0x4])) [1 MEM[(unsigned int *)b_13(D) + 4B]+0
S4 A32]))) "/app/example.cpp":3:20 159 {*zero_extendsidi2}
(nil))
(insn 29 8 11 2 (set (reg:DI 1 dx)
(reg:DI 36 r8)) "/app/example.cpp":3:20 -1
(nil))
Which is good.
cprop_hardreg can copyprop the value of r8 into dx's usage and able to remove
insn29. But does not do the same for cx for ax, I didn't look into why.
This is why the only one mov and not 2.
More information about the Gcc-bugs
mailing list