[Bug target/85993] config/sh/sh.c:10878: suspicious if .. else chain

amylaar at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 30 13:43:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85993

Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |olegendo at gcc dot gnu.org

--- Comment #2 from Jorn Wolfgang Rennecke <amylaar 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);
>         }

The condition for this block used to be:
  else if (! TARGET_SH5 && scratch0 != scratch1)
because the SH5 SHcompact indexed addressing doesn't actually work
the way GCC expects indexed addressing to work.

Thus, the second block (quoted first) is SH5 code.


More information about the Gcc-bugs mailing list