This is the mail archive of the gcc@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]

REQ_EQUAL and mems hoisted out of loops


gcc.c-torture/execute/991202-1.c has been failing at -O2 on
powerpc64-linux for some time.  The following rtl is just before cse2
goes wild.

When cse_insn looks at insn 50, it decides that insn 30 calculates the
same value and simplifies insn 50 down to

(set:DI (reg:DI 138) (reg:DI 127))

Oops, reg 145 has changed in the meantime at insn 41.  From what I can
tell, the REG_EQUAL notes in combination with the fact that the store
to "y" has been moved out of the loop by loop optimization, is the cause
of cse confusion.

So it seems a possible fix would be to delete all REG_EQUAL notes
that mention any mem hoisted out of a loop.  Before I try to do that,
I thought I'd solicit comments on the approach.  Reasonable?


(insn 30 28 31 1 (nil) (set:DI (reg:DI 127)
        (zero_extend:DI (reg/v:SI 145))) -1 (nil)
    (expr_list:REG_EQUAL (zero_extend:DI (mem/f:SI (symbol_ref:DI ("y")) [3 y+0 S4 A32]))
        (nil)))

(insn 31 30 32 1 (nil) (set (reg:SI 128)
        (subreg:SI (reg:DI 127) 4)) -1 (nil)
    (nil))

(insn 32 31 34 1 (nil) (set (reg/v:SI 148)
        (subreg:SI (reg:DI 127) 4)) 300 {*movsi_internal1} (nil)
    (nil))

(insn 34 32 36 1 (nil) (use (symbol_ref:DI ("y"))) -1 (nil)
    (nil))

(insn 36 34 41 1 (nil) (use (symbol_ref:DI ("y"))) -1 (nil)
    (nil))

(insn 41 36 43 1 (nil) (set (reg/v:SI 145)
        (ashift:SI (reg:SI 128)
            (const_int 1 [0x1]))) -1 (nil)
    (expr_list:REG_EQUAL (ashift:SI (reg:SI 128)
            (const_int 1 [0x1]))
        (nil)))

(note 43 41 46 1 NOTE_INSN_LOOP_CONT)

(insn 46 43 48 1 (nil) (use (symbol_ref:DI ("y"))) -1 (nil)
    (nil))

(insn 48 46 50 1 (nil) (use (symbol_ref:DI ("x"))) -1 (nil)
    (nil))

(insn 50 48 51 1 (nil) (set:DI (reg:DI 138)
        (zero_extend:DI (reg/v:SI 145))) -1 (nil)
    (expr_list:REG_EQUAL (zero_extend:DI (mem/f:SI (symbol_ref:DI ("y")) [3 y+0 S4 A32]))
        (nil)))

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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