http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49452

--- Comment #13 from Easwaran Raman <eraman at google dot com> 2011-07-14 
22:10:16 UTC ---
I looked at the dumps for 920501-7.c and second invocation of DSE removes a
necessary store. The relevant dump for function x from
920501-7.c.198r.pro_and_epilogue is below:

(insn 2 58 53 2 (set (mem/c:SI (plus:SI (reg/f:SI 11 fp)
                (const_int -56 [0xffffffffffffffc8])) [6 %sfp+-20 S4 A32])
        (reg:SI 0 r0 [ a ]))
/scratch/janisjo/arm-linux-fsf/src/gcc-mainline/gcc/testsuite/gcc.reghunt/920501-7.c:12
176 {*arm_movsi_insn}
     (nil))
...

(call_insn/c/i 11 9 12 2 (parallel [
            (call (mem:SI (symbol_ref:SI ("y.1271") [flags 0x3]  <function_decl
0x5578cb80 y>) [0 y S4 A32])
                (const_int 0 [0]))
            (use (const_int 0 [0]))
            (clobber (reg:SI 14 lr))
        ])
/scratch/janisjo/arm-linux-fsf/src/gcc-mainline/gcc/testsuite/gcc.reghunt/920501-7.c:20
242 {*call_symbol}
     (expr_list:REG_NORETURN (const_int 0 [0])
        (expr_list:REG_EH_REGION (const_int 0 [0])
            (nil)))
    (expr_list:REG_DEP_TRUE (use (reg:SI 0 r0))
        (expr_list:REG_DEP_TRUE (use (reg:SI 12 ip))
            (nil))))

...
(insn 24 18 30 3 (set (reg/i:SI 0 r0)
        (mem/c:SI (plus:SI (reg/f:SI 11 fp)
                (const_int -20 [0xffffffffffffffec])) [6 %sfp+-20 S4 A32]))
/scratch/janisjo/arm-linux-fsf/src/gcc-mainline/gcc/testsuite/gcc.reghunt/920501-7.c:23
176 {*arm_movsi_insn}
     (nil))



Instruction 2 and 24 refer to the same location, but have different offset
relative to FP because the call to y changes FP. DSE doesn't (and can not, if
it is intra-procedural) know that they both refer to the same location and
hence thinks insn 2 is dead. 

It seems to me this (FP having different value after the call) can only happen
at postreload. It seems to me that setting wild_read (not just
non_frame_wild_read) on all calls after postreload will fix this problem.
What's the best way to do that? Will checking for clear_alias_sets != NULL
work?

Reply via email to