[Bug rtl-optimization/78579] redundant instruction of the form cmp r0, r0 generated in assembly with -O2
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 29 09:52:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78579
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-11-29
CC| |bernds at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Well, it's really the inability to optimize away the comparison post-reload.
Only the register allocator figures that the return value is equal to the arg.
I'd have expected postreload-cse to handle this but it doesn't (it doesn't
copy-propagate). jump2 faces
(insn 14 29 15 2 (set (reg:CCZ 17 flags)
(compare:CCZ (reg/f:DI 0 ax [orig:87 _1 ] [87])
(reg:DI 0 ax [92]))) "t.c":3 8 {*cmpdi_1}
(expr_list:REG_DEAD (reg:DI 0 ax [92])
(nil)))
but it doesn't seem to be able to do anything about it (maybe the pass name
puts up hope too high...).
That said, pass_postreload_cse should have done its job here.
More information about the Gcc-bugs
mailing list