Bug 20612 - ICE in verify_ssa for -ftree-loop-linear
Summary: ICE in verify_ssa for -ftree-loop-linear
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Daniel Berlin
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2005-03-24 00:26 UTC by Janis Johnson
Modified: 2005-04-20 02:08 UTC (History)
3 users (show)

See Also:
Host: powerpc-linux
Target: powerpc-linux
Build: powerpc-linux
Known to work:
Known to fail:
Last reconfirmed: 2005-03-24 04:32:49


Attachments
minimized testcase (132 bytes, text/plain)
2005-03-24 00:27 UTC, Janis Johnson
Details
20612.diff (717 bytes, patch)
2005-03-24 04:32 UTC, Daniel Berlin
Details | Diff
20612.diff (864 bytes, patch)
2005-03-25 14:49 UTC, Daniel Berlin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2005-03-24 00:26:31 UTC
The SPEC CPU2000 benchmark 171.swim fails to build on powerpc64-linux
using "-m32 -O2 -ftree-loop-linear" with current GCC mainline due to
an ICE in verify_ssa.  I'll attach a minimized test case that gets the
same error:
                                                                                
elm3b145% /opt/gcc-nightly/mline-20050322/bin/gfortran -O2 -ftree-loop-linear -c
bug.f
bug.f: In function ‘MAIN__’:
bug.f:7: error: Definition in block 9 does not dominate use in block 3
for SSA_NAME: lnivtmp.4_34in statement:
if (lletmp.6_32 <= lnivtmp.4_34) goto <L20>; else goto <L21>;
bug.f:7: internal compiler error: verify_ssa failed.
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
                                                                                
The failure starts sometime between 2005-03-01 09:57 UTC and
2005-03-02 02 03:03 UTC; my regression hunt ran into a build failure
in that range but I'll try to continue it to identify the patch that
introduced the bug or exposed a latent bug.
Comment 1 Janis Johnson 2005-03-24 00:27:47 UTC
Created attachment 8440 [details]
minimized testcase
Comment 2 Andrew Pinski 2005-03-24 00:52:54 UTC
There are only two patches during that time frame could have caused this:
+2005-03-01  Daniel Berlin <dberlin@dberlin.org>
+
+       * Makefile.in (tree-ssa-sink.o): New.


and:
+2005-03-01  Zdenek Dvorak  <dvorakz@suse.cz>
+
+       * cfgloop.c (flow_loop_entry_edges_find, flow_loop_exit_edges_find,
+       flow_loop_pre_header_scan, flow_loop_pre_header_find,
Comment 3 Andrew Pinski 2005-03-24 04:04:27 UTC
And easy winner is:
+2005-03-01  Daniel Berlin <dberlin@dberlin.org>
+
+       * Makefile.in (tree-ssa-sink.o): New.

using -fno-tree-sink causes no ICE.
Comment 4 Daniel Berlin 2005-03-24 04:19:13 UTC
I know what's up
Comment 5 Daniel Berlin 2005-03-24 04:21:07 UTC
To add some more detail:

We sink the iv increment because it wasn't used in the old exit test.

However, the exit test we want to generate wants to use it, but because we sunk
it, it no longer dominates the right block.
The easy fix here is to take the iv var, increment it on our own (instead of
trying to use the pre-inc'ed version), and just let rednudancy elimination sort
the rest out :)
Comment 6 Daniel Berlin 2005-03-24 04:32:09 UTC
Subject: Bug 20612

Try this patch, and let me know if it fixes it for yuo (it does for me).
I don't have a ppc64 machine handy that runs spec, but i did try it on
ppc32.

Comment 7 Daniel Berlin 2005-03-24 04:32:10 UTC
Created attachment 8443 [details]
20612.diff
Comment 8 Daniel Berlin 2005-03-24 04:32:49 UTC
i accidently marked it suspended :(
Comment 9 Janis Johnson 2005-03-24 18:51:15 UTC
I tried the patch with a biarch powerpc64-linux compiler; sixtrack now
works with "-m32 -O2 -ftree-loop-linear" but the swim compile dies in a
new place:

/home/janis/tools/gcc-mline-20050323-20612/bin/gfortran -c -o swim.o
-m32 -O2 -ftree-loop-linear   swim.f
swim.f: In function ‘MAIN__’:
swim.f:46: internal compiler error: in get_loop_body, at cfgloop.c:819

This ought to be reproducible with a vanilla powerpc-linux cross compiler
but I haven't tried that and won't have time to play with this for a few
days.
Comment 10 Daniel Berlin 2005-03-25 14:49:28 UTC
Subject: Bug 20612

This allows swim to compile and run on ppc32 for me.

Comment 11 Daniel Berlin 2005-03-25 14:49:28 UTC
Created attachment 8455 [details]
20612.diff
Comment 12 GCC Commits 2005-04-11 18:55:53 UTC
Subject: Bug 20612

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dberlin@gcc.gnu.org	2005-04-11 18:55:47

Modified files:
	gcc            : ChangeLog lambda-code.c 

Log message:
	2005-04-11  Daniel Berlin  <dberlin@dberlin.org>
	
	Fix PR tree-optimization/20612
	* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Fix increment
	handling
	(perfect_nestify): preheaderbb is *not* part of loop of the
	old destination.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8233&r2=2.8234
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/lambda-code.c.diff?cvsroot=gcc&r1=2.32&r2=2.33

Comment 13 Daniel Berlin 2005-04-11 19:13:42 UTC
Fixed