[Bug target/85993] config/sh/sh.c:10878: suspicious if .. else chain
olegendo at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 31 15:45:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85993
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-05-31
Ever confirmed|0 |1
--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to David Binderman from comment #0)
> config/sh/sh.c:10878:12: warning: duplicated ‘if’ condition
> [-Wduplicated-cond]
>
> Source code is
>
> else if (scratch0 != scratch1)
> {
> emit_move_insn (scratch1, GEN_INT (vcall_offset));
> emit_insn (gen_add2_insn (scratch0, scratch1));
> offset_addr = scratch0;
> }
>
> but earlier is code
>
> else if (scratch0 != scratch1)
> {
> /* scratch0 != scratch1, and we have indexed loads. Get better
> schedule by loading the offset into r1 and using an indexed
> load - then the load of r1 can issue before the load from
> (this_rtx + delta) finishes. */
> emit_move_insn (scratch1, GEN_INT (vcall_offset));
> offset_addr = gen_rtx_PLUS (Pmode, scratch0, scratch1);
> }
>
> Interestingly, the two blocks of code in the ifs aren't the same.
The line 10864 used to be:
else if (! TARGET_SH5 && scratch0 != scratch1)
and I chopped it off to be
else if (scratch0 != scratch1)
when removing support for SH5. I haven't noticed that the 2nd else if block
became unreachable. It can be removed.
More information about the Gcc-bugs
mailing list