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.
Created attachment 8440 [details] minimized testcase
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,
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.
I know what's up
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 :)
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.
Created attachment 8443 [details] 20612.diff
i accidently marked it suspended :(
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.
Subject: Bug 20612 This allows swim to compile and run on ppc32 for me.
Created attachment 8455 [details] 20612.diff
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
Fixed