Bug 25211 - [4.1 Regression] verify_ssa ICE with -Os -ftree-loop-linear
Summary: [4.1 Regression] verify_ssa ICE with -Os -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.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on: 20256 26435
Blocks: 25937
  Show dependency treegraph
 
Reported: 2005-12-01 22:06 UTC by Janis Johnson
Modified: 2006-09-17 19:31 UTC (History)
3 users (show)

See Also:
Host:
Target: 32bit targets
Build:
Known to work: 4.0.3 4.2.0
Known to fail: 4.1.0
Last reconfirmed: 2006-02-12 18:02:32


Attachments
minimized testcase (164 bytes, text/plain)
2005-12-01 22:10 UTC, Janis Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2005-12-01 22:06:07 UTC
Current trunk and 4.1 branch ICE on powerpc-linux compiling mesa
from SPEC CPU2000:

elm3b11% /opt/gcc-nightly/4.1/bin/gcc -c -Os -ftree-loop-linear mesa1201.c
mesa1201.c: In function ‘foo’:
mesa1201.c:7: error: definition in block 9 does not dominate use in block 3
for SSA_NAME: q_25 in statement:
q_1 = PHI <q_15(0), q_25(3)>;
PHI argument
q_25
for PHI node
q_1 = PHI <q_15(0), q_25(3)>;
mesa1201.c:7: internal compiler error: verify_ssa failed

The testcase passes with GCC 4.0.2 and with the 4.0 branch.
A regression hunt identified the following very large patch:

  http://gcc.gnu.org/viewcvs?view=rev&rev=102356
  r102356 | irar | 2005-07-25 12:05:07 +0000 (Mon, 25 Jul 2005)

I'll attach a minimized testcase.
Comment 1 Janis Johnson 2005-12-01 22:10:28 UTC
Created attachment 10386 [details]
minimized testcase
Comment 2 Andrew Pinski 2005-12-02 15:56:40 UTC
Looks related to PR 20256.
Comment 3 Andrew Pinski 2005-12-02 15:58:25 UTC
Confirmed also on i686-pc-linux-gnu.
Comment 4 Ira Rosen 2005-12-14 13:11:16 UTC
I think the reason why this ICE occurs with my patch (http://gcc.gnu.org/viewcvs?view=rev&rev=102356) is that my patch enables data-refs analysis for INDIRECT_REFs. Similar ICE in PR 20256 happens also before my patch since the data-refs there are ARRAY_REFs, and ARRAY_REFs were already supported before.
Comment 5 Mark Mitchell 2005-12-19 19:07:08 UTC
I don't quite understand how likely we are to see this ICE; -Os -ftree-loop-linear seems like an obscure combination of flags.  I'll call it P2 for now.
Comment 6 Mark Mitchell 2006-02-24 00:26:33 UTC
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.
Comment 7 Andrew Pinski 2006-05-18 05:50:28 UTC
Fixed on the mainline by:

2006-05-17  Sebastian Pop  <pop@cri.ensmp.fr>
        
        PR middle-end/20256
        PR middle-end/26435
        * tree-loop-linear.c (linear_transform_loops): Don't test perfect_nest_p.
        Call rewrite_into_loop_closed_ssa only when something changed.
        * lambda.h (gcc_loopnest_to_lambda_loopnest): Update declaration.
        * lambda-code.c (can_convert_to_perfect_nest): Declared.
        (gcc_loopnest_to_lambda_loopnest): Removed need_perfect_nest parameter.
        Test for perfect_nest_p here.  Fix formating.
        (replace_uses_equiv_to_x_with_y): Fix formating.
        (stmt_uses_op): Removed.
        (can_convert_to_perfect_nest): Removed loopivs parameter.
        Complete the test by checking the scalar dependences.
        (perfect_nestify): Remove the test for can_convert_to_perfect_nest.
        Fix formating.
Comment 8 Mark Mitchell 2006-05-25 02:33:37 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 9 Sebastian Pop 2006-08-17 13:14:39 UTC
Subject: Bug 25211

Author: spop
Date: Thu Aug 17 13:14:26 2006
New Revision: 116223

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116223
Log:
	PR middle-end/25211
	PR middle-end/20256
	PR middle-end/26435
	* tree-loop-linear.c (linear_transform_loops): Don't test perfect_nest_p.
	Call rewrite_into_loop_closed_ssa only when something changed.
	* lambda.h (gcc_loopnest_to_lambda_loopnest): Update declaration.
	* lambda-code.c (can_convert_to_perfect_nest): Declared.
	(gcc_loopnest_to_lambda_loopnest): Removed need_perfect_nest parameter.
	Test for perfect_nest_p here.  Fix formating.
	(replace_uses_equiv_to_x_with_y): Fix formating.
	(stmt_uses_op): Removed.
	(can_convert_to_perfect_nest): Removed loopivs parameter.
	Complete the test by checking the scalar dependences.
	(perfect_nestify): Remove the test for can_convert_to_perfect_nest.
	Fix formating.  Don't copy statements in the inner loop: move them to
	the inner loop header.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/tree-ssa/pr20256.c
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/tree-ssa/pr26435.c
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/pr27745.f90
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/lambda-code.c
    branches/gcc-4_1-branch/gcc/lambda.h
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/tree-ssa/ltrans-1.c
    branches/gcc-4_1-branch/gcc/tree-loop-linear.c

Comment 10 Andrew Pinski 2006-09-17 19:31:59 UTC
Fixed.