public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56817] New: [4.8/4.9 Regression] ICE in hide_evolution_in_other_loops_than_loop
@ 2013-04-02 18:13 jakub at gcc dot gnu.org
  2013-04-03  8:21 ` [Bug tree-optimization/56817] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-02 18:13 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56817

             Bug #: 56817
           Summary: [4.8/4.9 Regression] ICE in
                    hide_evolution_in_other_loops_than_loop
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org


// { dg-do compile }
// { dg-options "-O3 --param max-unroll-times=32" }

struct A {};
A **q;
struct B
{
  A **j;
  B () { j = q; }
  A *& operator[] (unsigned long x) { return j[x]; }
};
struct C
{
  C (int r) : v (), s (r) {}
  A *& operator () (int i, int j) { return v[i * s + j]; }
  B v;
  int s;
};
struct D
{
  D ()
  {
    unsigned h = 2;
    for (int i = 0; i < 1; ++i, h *= 2)
      {
C w (h);
for (unsigned j = 0; j < h; ++j)
  for (unsigned k = 0; k < h; ++k)
    w (j, k) = new A;
      }
  }
};
void
foo ()
{
  for (int i = 0; i < 3; i++)
    A (), A (), D ();
}

ICEs with:
rh947433.C: In function ‘void foo()’:
rh947433.C:34:1: internal compiler error: in
hide_evolution_in_other_loops_than_loop, at tree-chrec.c:716
 foo ()
 ^

starting with http://gcc.gnu.org/r193098
>From gcc-bugs-return-419002-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 02 18:49:15 2013
Return-Path: <gcc-bugs-return-419002-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32395 invoked by alias); 2 Apr 2013 18:49:15 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 32365 invoked by uid 48); 2 Apr 2013 18:49:08 -0000
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/56818] New: [meta-bug] fortran-dev bugs
Date: Tue, 02 Apr 2013 18:49:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tkoenig at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56818-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg00147.txt.bz2
Content-length: 621


http://gcc.gnu.org/bugzilla/show_bug.cgi?idV818

             Bug #: 56818
           Summary: [meta-bug] fortran-dev bugs
    Classification: Unclassified
           Product: gcc
           Version: fortran-dev
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tkoenig@gcc.gnu.org


This is a meta bug for bugs which should be fixed,
if possible, before fortran-dev is merged, either because
they are regressions or because the array descriptor reform
or other ABI changes.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/56817] [4.8/4.9 Regression] ICE in hide_evolution_in_other_loops_than_loop
  2013-04-02 18:13 [Bug tree-optimization/56817] New: [4.8/4.9 Regression] ICE in hide_evolution_in_other_loops_than_loop jakub at gcc dot gnu.org
@ 2013-04-03  8:21 ` rguenth at gcc dot gnu.org
  2013-04-03 11:46 ` rguenth at gcc dot gnu.org
  2013-04-03 14:07 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-03  8:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56817

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-04-03
                 CC|                            |hubicka at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.8.1
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-03 08:21:29 UTC ---
Usually a sign of bogus wrto loop argument.

194       /* Induction variables are constants.  */
195       if (!simple_iv (loop, loop_containing_stmt (stmt), op, &iv, false))
196         return false;

op is defined in loop 4 which means it will get an evolution evolving in
loop 4, but stmt is in loop 6.  Both are nested inside loop (loop 1),
but they are not nested inside each other.

Which means you cannot compute a sensible evolution for op in loop 6
(which in the end means that simple_iv should return false, but that it
should not call analyze_scalar_evolution_in_loop for this loop/op combination).

Note that the caller above (tree_estimate_loop_size) is probably interested
in the evolution of 'op' in loop 'loop', not in the loop of the stmt
that uses op.  No?  Thus,

Index: tree-ssa-loop-ivcanon.c
===================================================================
--- tree-ssa-loop-ivcanon.c     (revision 197356)
+++ tree-ssa-loop-ivcanon.c     (working copy)
@@ -192,7 +192,7 @@ constant_after_peeling (tree op, gimple
     }

   /* Induction variables are constants.  */
-  if (!simple_iv (loop, loop_containing_stmt (stmt), op, &iv, false))
+  if (!simple_iv (loop, loop, op, &iv, false))
     return false;
   if (!is_gimple_min_invariant (iv.base))
     return false;

looks what we are interested in.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/56817] [4.8/4.9 Regression] ICE in hide_evolution_in_other_loops_than_loop
  2013-04-02 18:13 [Bug tree-optimization/56817] New: [4.8/4.9 Regression] ICE in hide_evolution_in_other_loops_than_loop jakub at gcc dot gnu.org
  2013-04-03  8:21 ` [Bug tree-optimization/56817] " rguenth at gcc dot gnu.org
@ 2013-04-03 11:46 ` rguenth at gcc dot gnu.org
  2013-04-03 14:07 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-03 11:46 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56817

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-03 11:46:27 UTC ---
Unfortunately seems to regress some testcases code-quality wise.

FAIL: g++.dg/asan/asan_test.C  -O2  AddressSanitizer_HugeMallocTest
Ident((char*
)malloc(size))[-1] = 0 output pattern test, should match is located 1 bytes to
t
he left of 4299161600-byte
FAIL: g++.dg/tree-ssa/ehcleanup-1.C -std=gnu++98  scan-tree-dump-times
ehcleanup
1 "Removing unreachable" 4
FAIL: g++.dg/tree-ssa/ehcleanup-1.C -std=gnu++11  scan-tree-dump-times
ehcleanup
1 "Removing unreachable" 4


FAIL: gcc.dg/vect/pr20122.c scan-tree-dump-times vect "vectorized 1 loops" 3
FAIL: gcc.dg/vect/pr38529.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED" 1
FAIL: gcc.dg/vect/vect-104.c scan-tree-dump-times vect "possible dependence
betw
een data-refs" 1
FAIL: gcc.dg/vect/vect-65.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/vect-double-reduc-6.c scan-tree-dump-times vect "OUTER LOOP
VE
CTORIZED" 1
FAIL: gcc.dg/vect/pr20122.c -flto  scan-tree-dump-times vect "vectorized 1
loops
" 3
FAIL: gcc.dg/vect/pr38529.c -flto  scan-tree-dump-times vect "OUTER LOOP
VECTORI
ZED" 1
FAIL: gcc.dg/vect/vect-104.c -flto  scan-tree-dump-times vect "possible
dependen
ce between data-refs" 1
FAIL: gcc.dg/vect/vect-65.c -flto  scan-tree-dump-times vect "vectorized 2
loops
" 1
FAIL: gcc.dg/vect/vect-double-reduc-6.c -flto  scan-tree-dump-times vect "OUTER 
LOOP VECTORIZED" 1
FAIL: gcc.dg/vect/no-section-anchors-vect-65.c scan-tree-dump-times vect
"vector
ized 2 loops" 1

that's because we unroll more (outer) loops :/  For example in pr20122.c
the loop in main:

Loop 2 iterates 24 times.
Loop 2 iterates at most 24 times.
Loop 1 iterates 8 times.
Loop 1 iterates at most 8 times.
Estimating sizes for loop 1
 BB: 6, after_exit: 0
  size:   2 if (k_1 <= 7)
   Exit condition will be eliminated in peeled copies.
 BB: 5, after_exit: 1
  size:   1 k_10 = k_1 + 1;
   Induction variable computation will be folded away.
 BB: 4, after_exit: 1
  size:   2 if (i_2 <= 23)
   Constant conditional.
 BB: 7, after_exit: 1
 BB: 3, after_exit: 1
  size:   1 Kernel[k_1][i_2] = 0;
  size:   1 i_9 = i_2 + 1;
   Induction variable computation will be folded away.
size: 7-6, last_iteration: 2-0
  Loop size: 7
  Estimated size after unrolling: 6

where

  size:   1 i_9 = i_2 + 1;
   Induction variable computation will be folded away.

is not true - this is not an induction variable of the outer loop.

Ah, the evolution in the outer loop is simply '24'.

So back to the testcase .. in fact SSA form is invalid at the time we query
the loop size estimate!  We peel loop 2 once which fails to update SSA
form properly.  That is because we then proceed to its outer loop 1
which walks over loop children loop bodies computing SCEV info and thus
relying on up-to-date SSA form.  That cannot work.  In fact this asks
for one of my very old "cleanups" - compute sizes up-front, for all of
the nest.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/56817] [4.8/4.9 Regression] ICE in hide_evolution_in_other_loops_than_loop
  2013-04-02 18:13 [Bug tree-optimization/56817] New: [4.8/4.9 Regression] ICE in hide_evolution_in_other_loops_than_loop jakub at gcc dot gnu.org
  2013-04-03  8:21 ` [Bug tree-optimization/56817] " rguenth at gcc dot gnu.org
  2013-04-03 11:46 ` rguenth at gcc dot gnu.org
@ 2013-04-03 14:07 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-03 14:07 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56817

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-03 14:07:23 UTC ---
Author: rguenth
Date: Wed Apr  3 13:41:13 2013
New Revision: 197411

URL: http://gcc.gnu.org/viewcvs?rev=197411&root=gcc&view=rev
Log:
2013-04-03  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/56817
    * tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely):
    Split out ...
    (tree_unroll_loops_completely_1): ... new function to manually
    walk the loop tree, properly defering outer loops of unrolled
    loops to later iterations.

    * g++.dg/torture/pr56817.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr56817.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-loop-ivcanon.c

Author: rguenth
Date: Wed Apr  3 14:06:53 2013
New Revision: 197414

URL: http://gcc.gnu.org/viewcvs?rev=197414&root=gcc&view=rev
Log:
2013-04-03  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/56817
    * tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely):
    Split out ...
    (tree_unroll_loops_completely_1): ... new function to manually
    walk the loop tree, properly defering outer loops of unrolled
    loops to later iterations.

    * g++.dg/torture/pr56817.C: New testcase.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/torture/pr56817.C
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-ssa-loop-ivcanon.c


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-03 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-02 18:13 [Bug tree-optimization/56817] New: [4.8/4.9 Regression] ICE in hide_evolution_in_other_loops_than_loop jakub at gcc dot gnu.org
2013-04-03  8:21 ` [Bug tree-optimization/56817] " rguenth at gcc dot gnu.org
2013-04-03 11:46 ` rguenth at gcc dot gnu.org
2013-04-03 14:07 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).