This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ipa/68273] [5/6 Regression] Wrong code on mips/mipsel with -fipa-sra


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

--- Comment #3 from Jeffrey A. Law <law at redhat dot com> ---
Created attachment 37414
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37414&action=edit
Reduced testcase

Reduced testcase.  Compile with a mipsel-linux-gnu cross compiler with -O2.

It's easiest to see the problem looking at the .expand dump:

;; _17 = enter (_14, prephitmp_23);

(insn 81 80 82 (set (reg/f:SI 262)
        (symbol_ref:SI ("sp")  <var_decl 0x7f289897eab0 sp>)) j.c:58 -1
     (nil))

(insn 82 81 83 (set (reg/f:SI 261)
        (mem/f/c:SI (reg/f:SI 262) [10 sp+0 S4 A32])) j.c:58 -1
     (nil))

(insn 83 82 84 (set (reg:SI 263)
        (mem/f:SI (reg/f:SI 261) [12 sp.0_13->table+0 S4 A32])) j.c:58 -1
     (nil))

(insn 84 83 85 (set (reg:SI 6 $6)
        (reg/f:SI 255 [ prephitmp_23 ])) j.c:58 -1
     (nil))

(insn 85 84 86 (set (reg:SI 4 $4)
        (reg:SI 263)) j.c:58 -1
     (nil))

(call_insn 86 85 87 (parallel [
            (set (reg:SI 2 $2)
                (call (mem:SI (symbol_ref:SI ("enter") [flags 0x41] 
<function_decl 0x7f2890d2ca80 enter>) [0 enter S4 A32])
                    (const_int 16 [0x10])))
            (clobber (reg:SI 31 $31))
        ]) j.c:58 -1
     (expr_list:REG_CALL_DECL (symbol_ref:SI ("enter") [flags 0x41] 
<function_decl 0x7f2890d2ca80 enter>)
        (nil))
    (expr_list (use (reg:SI 79 $fakec))
        (expr_list:SI (use (reg:SI 4 $4))
            (expr_list:SI (use (reg:SI 6 $6))
                (nil)))))


Note carefully the 2nd argument to the enter call is loaded into $6.  It should
have been loaded into $5.  AFAICT, SRA is mucking around with the alignment of
the object, which in turn causes the MIPS backend to want to pass the object in
an aligned register pair.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]