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 rtl-optimization/45652] [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2



------- Comment #2 from amonakov at gcc dot gnu dot org  2010-09-13 16:53 -------
Confirmed.  Not related to PR43949 since selective scheduling does not use
cselib.  The miscompilation seems to come from RTL aliasing: sel-sched lifts a
load that references stack via a general-purpose register above a store via
%rsp.

"bad"  cmdline: cc1 -O2 -fselective-scheduling2 -fdbg-cnt=sel_sched_insn_cnt:31
"good" cmdline: cc1 -O2 -fselective-scheduling2 -fdbg-cnt=sel_sched_insn_cnt:30

The no-aliasing decision comes from (base_alias_check):
1742      /* If one address is a stack reference there can be no alias:
1743         stack references using different base registers do not alias,
1744         a stack reference can not alias a parameter, and a stack reference
1745         can not alias a global.  */
1746      if ((GET_CODE (x_base) == ADDRESS && GET_MODE (x_base) == Pmode)
1747          || (GET_CODE (y_base) == ADDRESS && GET_MODE (y_base) == Pmode))
1748        return 0;

Related GDB session:
Breakpoint 4, base_alias_check (x=0x7ffff6f20920, y=0x7ffff6f2d018,
x_mode=DImode, y_mode=SImode) at
/home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:1687
1687      rtx x_base = find_base_term (x);
(gdb) up
#1  0x000000000076da1d in true_dependence_1 (mem=0x7ffff6f2d030,
mem_mode=SImode, mem_addr=0x7ffff6f2d018, x=0x7ffff6f30870,
x_addr=0x7ffff6f20920, 
    varies=0x14041f2 <rtx_varies_p>, mem_canonicalized=0 '\000') at
/home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:2440
2440      if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
(gdb) call debug_rtx(mem)
(mem/s/c:SI (plus:DI (reg/f:DI 7 sp)
        (const_int 12 [0xc])) [5 ap.fp_offset+0 S4 A32])
(gdb) call debug_rtx(x)
(mem/s:DI (reg:DI 4 si) [0 MEM[(struct S * {ref-all})addr.0_2]+0 S8 A64])
(gdb) down
#0  base_alias_check (x=0x7ffff6f20920, y=0x7ffff6f2d018, x_mode=DImode,
y_mode=SImode) at /home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:1687
1687      rtx x_base = find_base_term (x);
(gdb) n
...
(gdb) list
1741    
1742      /* If one address is a stack reference there can be no alias:
1743         stack references using different base registers do not alias,
1744         a stack reference can not alias a parameter, and a stack reference
1745         can not alias a global.  */
1746      if ((GET_CODE (x_base) == ADDRESS && GET_MODE (x_base) == Pmode)
1747          || (GET_CODE (y_base) == ADDRESS && GET_MODE (y_base) == Pmode))
1748        return 0;
1749    
1750      return 1;
(gdb) call debug_rtx(x_base)
(address (reg:DI 4 si))
(gdb) call debug_rtx(y_base)
(address:DI (reg/f:DI 7 sp))
(gdb) fin
Run till exit from #0  base_alias_check (x=0x7ffff6f20920, y=0x7ffff6f2d018,
x_mode=DImode, y_mode=SImode)
    at /home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:1746
0x000000000076da1d in true_dependence_1 (mem=0x7ffff6f2d030, mem_mode=SImode,
mem_addr=0x7ffff6f2d018, x=0x7ffff6f30870, x_addr=0x7ffff6f20920, 
    varies=0x14041f2 <rtx_varies_p>, mem_canonicalized=0 '\000') at
/home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:2440
2440      if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
Value returned is $58 = 0


-- 

amonakov at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-13 16:53:59
               date|                            |


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


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