Bug 37447 - [4.4 Regression] test pr28982b.c fails execution on power4 or later with ira change
Summary: [4.4 Regression] test pr28982b.c fails execution on power4 or later with ira ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P1 blocker
Target Milestone: 4.4.0
Assignee: Richard Henderson
URL:
Keywords: ra, wrong-code
Depends on:
Blocks:
 
Reported: 2008-09-09 18:03 UTC by Janis Johnson
Modified: 2008-10-12 20:27 UTC (History)
8 users (show)

See Also:
Host:
Target: powerpc*-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-10-01 23:10:20


Attachments
proposed patch (3.71 KB, patch)
2008-10-01 23:19 UTC, Richard Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2008-09-09 18:03:45 UTC
Test gcc.c-torture/execute/pr28982b.c started failing execution for all -O2 and -O3 options on powerpc64-linux with -m32 with this patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=139993

    r139993 | rsandifo | 2008-09-04 18:47:35 +0000 (Thu, 04 Sep 2008)

It still fails as of r140162.  The test passes with a powerpc-linux compiler with default cpu options but fails with -mcpu=power4 or later.
Comment 1 Andrew Pinski 2008-09-09 18:23:20 UTC
Confirmed, I see it too.  I configure GCC with --with-tune=cell.
Comment 2 Peter Bergner 2008-09-10 15:14:54 UTC
With a mainline from today, it fails for me at -O2.  Looking into it, it's
foo() that is miscompiled (I broke the 3 functions into their own files and
recompiled them),  It's also the last element of results (ie, results[19] that
miscompares (141 versus expected value of 190).

Comment 3 Richard Henderson 2008-10-01 23:19:58 UTC
Created attachment 16446 [details]
proposed patch

Please try this and see if it works.  I believe it does, since I see

-       stw 21,16(9)
-       addis 21,1,0x8
[lots of code]
+       stw 21,16(9)
+       addis 21,1,0x8

which suggests that the memory store hasn't been promoted
above where it ought.
Comment 4 Janis Johnson 2008-10-02 00:21:10 UTC
The test passes with a simple build of gcc with the patch from comment#3.  I fired off a bootstrap and testsuite run.
Comment 5 Luis Machado 2008-10-02 01:43:45 UTC
This problem also showed up as a CPU2000 regression in the Sixtrack benchmark for PPC64, causing problems in the ondering of ld/st instructions.

A GCC patched with Richard's fix produced the right code and the regression is gone.
Comment 6 Alexander Monakov 2008-10-02 11:27:47 UTC
This patch also fixes miscompilation of vla1.f90 test on ia64 on sel-sched branch.
Comment 7 Janis Johnson 2008-10-02 16:22:48 UTC
The patch from comment #3 passes bootstrap and regtests on powerpc64-linux.
Comment 8 Richard Henderson 2008-10-12 20:27:26 UTC
Fixed.
Comment 9 Richard Henderson 2008-10-12 20:27:41 UTC
Subject: Bug 37447

Author: rth
Date: Sun Oct 12 20:26:24 2008
New Revision: 141077

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141077
Log:
        PR middle-end/37447
        * Makefile.in (reload1.o): Depend on EMIT_RTL_H.
        * alias.c (value_addr_p, stack_addr_p): Remove.
        (nonoverlapping_memrefs_p): Remove IRA special case.
        * emit-rtl.c (get_spill_slot_decl, set_mem_attrs_for_spill): New.
        * emit-rtl.h (set_mem_attrs_for_spill): Declare.
        * reload1.c (alter_reg): Use it.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/alias.c
    trunk/gcc/emit-rtl.c
    trunk/gcc/emit-rtl.h
    trunk/gcc/reload1.c

Comment 10 hjl@gcc.gnu.org 2008-10-12 21:45:49 UTC
Subject: Bug 37447

Author: hjl
Date: Sun Oct 12 21:44:33 2008
New Revision: 141079

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141079
Log:
2008-10-12  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2008-10-12  Richard Henderson  <rth@redhat.com>

	PR middle-end/37447
	* Makefile.in (reload1.o): Depend on EMIT_RTL_H.
	* alias.c (value_addr_p, stack_addr_p): Remove.
	(nonoverlapping_memrefs_p): Remove IRA special case.
	* emit-rtl.c (get_spill_slot_decl, set_mem_attrs_for_spill): New.
	* emit-rtl.h (set_mem_attrs_for_spill): Declare.
	* reload1.c (alter_reg): Use it.

Modified:
    branches/ira-merge/gcc/ChangeLog.ira
    branches/ira-merge/gcc/Makefile.in
    branches/ira-merge/gcc/alias.c
    branches/ira-merge/gcc/emit-rtl.c
    branches/ira-merge/gcc/emit-rtl.h
    branches/ira-merge/gcc/reload1.c