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]

Re: An alias bug



  In message <m0yv1aW-000266C@ocean.lucon.org>you write:
  > > 
  > >   > 2. For sched.c, we have
  > >   > 
  > >   > 	set MEM(add1) reg
  > >   > 	set reg MEM(addr2)
  > >   > 
  > >   > sched2 thinks "set MEM(add1) reg" has higher cost than
  > >   > "set reg MEM(addr2)". It reorder it to:
  > >   > 
  > >   > 	set reg MEM(addr2)
  > >   > 	set MEM(add1) reg
  > >   > 
  > >   > Although addr1 and addr2 look nothing in common, in fact, they have
  > >   > the same value. That is a bug in sched2. Maybe a better aliase
  > >   > analysis can help here.
  > > "higher cost?"  We'd have to have a testcase for this too.   This could
  > > be a bug in the alias code or in libg++ itself.  We won't know for sure
  > > until we get a testcase.  Again, I'm not x86 savvy enough to debug
  > > the problem and create a testcase.
  > > 
  > 
  > Here is a testcase. Compile it with -O2. You should get a core dump
  > on x86. The problem is aliase code cannot tell in
[ ... ]
This one runs just fine too on my x86 compiled with -O2.

Thanks for the RTL.  It would have helped if you at least mentioned
what function this code was from -- it was nontrivial to find this
rtl in my dump files because the insn #s don't exactly match.

Compiling with -O2 on my x86 I get this in my .greg dump in main:

(code_label/i 462 461 887 973 "")

(insn 887 462 463 (set (reg:SI 4 %esi)
        (mem:SI (plus:SI (reg:SI 6 %ebp)
                (const_int -88)))) 54 {movsi+2} (nil)
    (nil))

(insn/i:HI 463 887 464 (set (mem/s:SI (reg:SI 4 %esi))
        (reg:SI 0 %eax)) 54 {movsi+2} (nil)
    (expr_list:REG_DEAD (reg:SI 0 %eax)
        (expr_list:REG_DEAD (mem:SI (plus:SI (reg:SI 6 %ebp)
                    (const_int -88)))
            (nil))))

[ random note insns ]

(insn 810 469 836 (set (reg:SI 1 %edx)
        (mem:SI (plus:SI (reg:SI 6 %ebp)
                (const_int -68)))) 54 {movsi+2} (nil)
    (nil))

In my .sched2 dump I get:

[ random note insns ]

(insn 887 836 463 (set (reg:SI 4 %esi)
        (mem:SI (plus:SI (reg:SI 6 %ebp)
                (const_int -88)))) 54 {movsi+2} (nil)
    (nil))

(insn/i:HI 463 887 810 (set (mem/s:SI (reg:SI 4 %esi))
        (reg:SI 0 %eax)) 54 {movsi+2} (insn_list 887 (nil))
    (expr_list:REG_DEAD (reg:SI 0 %eax)
        (expr_list:REG_DEAD (mem:SI (plus:SI (reg:SI 6 %ebp)
                    (const_int -88)))
            (nil))))

(insn 810 463 811 (set (reg:SI 1 %edx)
        (mem:SI (plus:SI (reg:SI 6 %ebp)
                (const_int -68)))) 54 {movsi+2} (nil)
    (nil))


Nothing got moved in an unsafe manner as far as I can tell.

jeff


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