Bug 11229 - pure-1.c fails on powerpc64-linux with -O1
Summary: pure-1.c fails on powerpc64-linux with -O1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.0
Assignee: Alan Modra
URL:
Keywords: missed-optimization, patch
Depends on:
Blocks:
 
Reported: 2003-06-18 00:07 UTC by janis187
Modified: 2003-12-03 11:13 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc64-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-06-25 13:31:29


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janis187 2003-06-18 00:07:29 UTC
The test gcc.c-torture/execute/pure-1.c fails on
powerpc64-unknown-linux-gnu with -O1 and higher levels of optimization.
This happens with mainline, 3.3, and 3.2; I've never been able to build
earlier versions of GCC for this target.

Alan Modra described the problem and proposed a patch in
http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02371.html; that patch
has never been reviewed.

This was tested with a cross compiler from powerpc-linux on a
powerpc64-linux system, which is the usual way to use GCC for this
target.
Comment 1 Andrew Pinski 2003-06-25 13:31:29 UTC
I can confirm on the mainline (20030625), this still happens.
Comment 2 David Edelsohn 2003-07-12 23:51:21 UTC
The patch should be reposted to gcc-patches as an "unreviewed" patch.
Comment 3 Zack Weinberg 2003-12-02 00:22:48 UTC
I would like to know for sure whether src_eqv_elt should have been set earlier.
Comment 4 Alan Modra 2003-12-02 02:28:05 UTC
Probably not.  Looking over the code again, it appears to me that src_eqv_elt
should only be set when there is a REG_EQUAL note on an insn.

See also http://gcc.gnu.org/ml/gcc-patches/2003-08/msg01695.html

And what looks like a different approach to fixing the same problem:
http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01611.html
I'm doing a build now to see if that's the case.
Comment 5 Alan Modra 2003-12-02 02:35:51 UTC
Yes, http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01611.html also fixes the
powerpc64-linux pure-1.c failures.
Comment 6 Alan Modra 2003-12-02 03:25:29 UTC
Hmm, there are some interesting differences in the behaviour of the two patches.
 My patch allows cse to remove the dead calls to link_error*.  With Fariborz's
patch, the calls stay until combine cleans things up.  Also, -O1 code is better
with my patch as it allows life analysis to remove stores to i[0..7].
Comment 7 Zack Weinberg 2003-12-02 04:19:32 UTC
I think this patch is correct -- the ideal solution may be more complicated, but
let's not worry about that in stage 3.
Comment 8 GCC Commits 2003-12-03 11:10:04 UTC
Subject: Bug 11229

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amodra@gcc.gnu.org	2003-12-03 11:09:56

Modified files:
	gcc            : ChangeLog cse.c 

Log message:
	PR target/11229
	* cse.c (cse_insn): Set classp using src_const_elt if
	src_eqv_elt is NULL.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1899&r2=2.1900
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cse.c.diff?cvsroot=gcc&r1=1.276&r2=1.277

Comment 9 Alan Modra 2003-12-03 11:13:21 UTC
Patch committed for gcc-3.4
Comment 10 GCC Commits 2004-01-31 12:38:31 UTC
Subject: Bug 11229

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	hammer-3_3-branch
Changes by:	amodra@gcc.gnu.org	2004-01-31 12:38:28

Modified files:
	gcc            : ChangeLog.hammer cse.c 

Log message:
	Backport from mainline.
	2003-12-03  Alan Modra  <amodra@bigpond.net.au>
	PR target/11229
	* cse.c (cse_insn): Set classp using src_const_elt if
	src_eqv_elt is NULL.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.hammer.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1.2.300&r2=1.1.2.301
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cse.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.243.2.7&r2=1.243.2.8