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

dcb314 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Wed May 30 07:32:00 GMT 2018


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

            Bug ID: 85993
           Summary: config/sh/sh.c:10878: suspicious if .. else chain
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---
            Target: sh

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.


More information about the Gcc-bugs mailing list