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

            Bug ID: 89245
           Summary: [MIPS] v1 is assigned in jalr delay slot for later use
                    at -Os
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i...@mobile-stream.com
  Target Milestone: ---

Created attachment 45638
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45638&action=edit
preprocessed LuaJIT-2.1.0-beta3/src/lj_asm.c

command line:
gcc -mips32r2 -mhard-float -fPIC -Os lj_asm.i

generated assembly (asm_href):

        lw      $2,40($sp)
        andi    $6,$2,0x1f
$L942:
        jalr    $25
        li      $3,-1944125440                  # 0xffffffff8c1f0000

        lw      $4,256($16)
        addiu   $3,$3,12

where $25 is loaded earlier with the address of emit_tsi.isra.2 (which mangles
$3).

the problem goes away with "-Os -fschedule-insns" (i.e. like at -O2) or "-Os
-fno-schedule-insns2".

"-fno-ipa-sra" changes nothing.

also happens with gcc-6 (codescape-2018.09-03 or debian stretch mipsel) and
gcc-7 (codescape-2018.11-01).

Reply via email to