Bug 38510 - Matrix.c from pymol 1.1r2 fails to compile with -O2 -fgraphite
Summary: Matrix.c from pymol 1.1r2 fails to compile with -O2 -fgraphite
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: hjagasia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-12 22:42 UTC by Jack Howarth
Modified: 2009-01-05 23:31 UTC (History)
3 users (show)

See Also:
Host: i686-apple-darwin9
Target: i686-apple-darwin9
Build: i686-apple-darwin9
Known to work:
Known to fail:
Last reconfirmed:


Attachments
preprocessed source for pymol-1.1/layer0/Matrix.i (62.04 KB, text/plain)
2008-12-12 22:44 UTC, Jack Howarth
Details
Proposed patch (1.05 KB, patch)
2008-12-19 05:31 UTC, hjagasia
Details | Diff
Fixed changes suggested by Sebastian Pop. (1.03 KB, patch)
2008-12-19 18:20 UTC, hjagasia
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Howarth 2008-12-12 22:42:23 UTC
The source file pymol-1.1/layer0/Matrix.c fails to compile under gcc trunk with either '-O2 -fgraphite-identity' or '-O1 -fgraphite-identity'. In the first case the failure is...

gcc-4 -fgraphite-identity -O2 -D_HAVE_LIBPNG -D_PYMOL_MODULE -D_PYMOL_NUMPY -D_PYMOL_FINK  -c -o Matrix.o Matrix.iMatrix.c: In function ‘pymol_rg_’:Matrix.c:3059: error: edge from 641 to 9 should be marked irreducible
Matrix.c:3059: error: basic block 644 should be marked irreducible
Matrix.c:3059: error: edge from 644 to 642 should be marked irreducible
Matrix.c:3059: error: edge from 640 to 11 should be marked irreducible
Matrix.c:3059: internal compiler error: in verify_loop_structure, at cfgloop.c:1569

In the second case, the failure is...

gcc-4 -fgraphite-identity -O1 -D_HAVE_LIBPNG -D_PYMOL_MODULE -D_PYMOL_NUMPY -D_PYMOL_FINK -c -o Matrix.o Matrix.i
Matrix.c: In function ‘MatrixFitRMSTTTf’:
Matrix.c:963: internal compiler error: in canonicalize_loop_ivs, at tree-parloops.c:1385

Only '-O0 -fgraphite-identity' compiles this source file without compile time errors.
Comment 1 Jack Howarth 2008-12-12 22:44:29 UTC
Created attachment 16899 [details]
preprocessed source for pymol-1.1/layer0/Matrix.i

Compile with either...

gcc-4 -fgraphite-identity -O2 -D_HAVE_LIBPNG -D_PYMOL_MODULE -D_PYMOL_NUMPY -D_PYMOL_FINK  -c -o Matrix.o Matrix.i

or

gcc-4 -fgraphite-identity -O1 -D_HAVE_LIBPNG -D_PYMOL_MODULE -D_PYMOL_NUMPY -D_PYMOL_FINK -c -o Matrix.o Matrix.i

to reproduce the failures.
Comment 2 Jack Howarth 2008-12-13 21:43:53 UTC
Using r142742, '-O1 -fgraphite-identity' now compiles Matrix.c, however '-O2 -fgraphite-identity' still has the compile time errors...

Matrix.c: In function ‘pymol_rg_’:
Matrix.c:3059: error: edge from 509 to 9 should be marked irreducible
Matrix.c:3059: error: basic block 512 should be marked irreducible
Matrix.c:3059: error: edge from 512 to 510 should be marked irreducible
Matrix.c:3059: error: edge from 508 to 11 should be marked irreducible
Matrix.c:3059: internal compiler error: in verify_loop_structure, at cfgloop.c:1569

Comment 3 hjagasia 2008-12-19 05:31:37 UTC
Created attachment 16942 [details]
Proposed patch

2008-12-18  Harsha Jagasia  <harsha.jagasia@amd.com>

	PR tree-optimization/38510
	* gcc.dg/graphite/pr38510.c: New.
	* graphite.c (translate_clast): Call mark_irreducible_loops before
	 graphite_verify.
	(gloog): Call mark_irreducible_loops before graphite_verify.
Comment 4 hjagasia 2008-12-19 18:20:52 UTC
Created attachment 16946 [details]
Fixed changes suggested by Sebastian Pop.

2008-12-19  Harsha Jagasia  <harsha.jagasia@amd.com>

	PR tree-optimization/38510
	* gcc.dg/graphite/pr38510.c: New.
	* graphite.c (recompute_all_dominators): Call mark_irreducible_loops.
	  (translate_clast): Call recompute_all_dominators before 
	  graphite_verify.
	  (gloog): Call recompute_all_dominators before graphite_verify.
Comment 5 Jack Howarth 2008-12-20 03:18:37 UTC
I can confirm that current (r142846)  gcc trunk, with the changes from r142728, r142722 and proposed patch in Comment 4 applied, builds pymol 1.1r2 completely under either -O3 or -O2 and -fgraphite-identity -funroll-loops -fomit-frame-pointer -ffast-math. The resulting pymol runs fine.
Comment 6 Sebastian Pop 2008-12-20 07:43:55 UTC
Subject: Re:  Matrix.c from pymol 1.1r2 fails to compile with -O2 -fgraphite

> ------- Comment #4 from hjagasia at gcc dot gnu dot org  2008-12-19 18:20 -------
> Created an attachment (id=16946)
>  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16946&action=view)
> Fixed changes suggested by Sebastian Pop.
>

Why did you introduced all these calls of recompute_all_dominators
before the graphite_verify functions?  Are all these calls needed?
I don't think so.  For instance, here:

+  recompute_all_dominators ();
   graphite_verify ();
   cleanup_tree_cfg ();
   recompute_all_dominators ();

recompute_all_dominators is called twice with just cleanup_tree_cfg in
between.  I do not like the recompute_all_dominators calls: in the
long run we should have all this information correctly updated during
code generation, and not rely at all on recompute_all_dominators.

If you can minimize the number of calls to recompute_all_dominators it
would be nice, otherwise the patch is ok.

Thanks,
Sebastian
Comment 7 hjagasia 2008-12-22 19:26:23 UTC
Subject: Bug 38510

Author: hjagasia
Date: Mon Dec 22 19:24:59 2008
New Revision: 142888

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142888
Log:
2008-12-22  Harsha Jagasia  <harsha.jagasia@amd.com>

	PR tree-optimization/38510
	* gcc.dg/graphite/pr38510.c: New.
	* graphite.c (recompute_all_dominators): Call mark_irreducible_loops.
	  (translate_clast): Call recompute_all_dominators before 
	  graphite_verify.
	  (gloog): Call recompute_all_dominators before graphite_verify.


Added:
    branches/graphite/gcc/testsuite/gcc.dg/graphite/pr38510.c
Modified:
    branches/graphite/gcc/ChangeLog.graphite
    branches/graphite/gcc/graphite.c

Comment 8 Sebastian Pop 2009-01-05 21:04:05 UTC
Subject: Bug 38510

Author: spop
Date: Mon Jan  5 21:03:45 2009
New Revision: 143094

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143094
Log:
2009-01-05  Harsha Jagasia  <harsha.jagasia@amd.com>

	PR tree-optimization/38510
	* graphite.c (recompute_all_dominators): Call mark_irreducible_loops.
	(translate_clast): Call recompute_all_dominators before
	graphite_verify.
	(gloog): Call recompute_all_dominators before graphite_verify.

2009-01-05  Harsha Jagasia  <harsha.jagasia@amd.com>
	    Jan Sjodin <jan.sjodin@amd.com>

	PR tree-optimization/38500
	* graphite.c (create_sese_edges): Call fix_loop_structure after
	splitting blocks.

2009-01-05  Harsha Jagasia  <harsha.jagasia@amd.com>

	PR tree-optimization/38510
	* gcc.dg/graphite/pr38510.c: New.

2009-01-05  Harsha Jagasia  <harsha.jagasia@amd.com>
	    Jan Sjodin <jan.sjodin@amd.com>

	PR tree-optimization/38500
	* gcc.dg/graphite/pr38500.c: New.


Added:
    trunk/gcc/testsuite/gcc.dg/graphite/pr38500.c
    trunk/gcc/testsuite/gcc.dg/graphite/pr38510.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/graphite.c
    trunk/gcc/testsuite/ChangeLog

Comment 9 Sebastian Pop 2009-01-05 23:31:02 UTC
Fixed.