public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
@ 2011-03-25 17:54 rguenth at gcc dot gnu.org
  2011-03-25 18:15 ` [Bug tree-optimization/48290] " irar at il dot ibm.com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-25 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: FAIL: gcc.dg/vect/pr38529.c, ICE in
                    vect_get_vec_def_for_operand, at
                    tree-vect-stmts.c:1072
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org
                CC: irar@gcc.gnu.org


The vectorizer seems to mishandle PHIs for

<bb 3>:

<bb 4>:
  # j_17 = PHI <j_5(3), 0(7)>
  # ivtmp.6_14 = PHI <ivtmp.6_15(3), 17(7)>
  j_5 = j_17 + 1;
  ivtmp.6_15 = ivtmp.6_14 - 1;
  if (ivtmp.6_15 != 0)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 5>:
  # a_I_lsm.4_2 = PHI <0.0(4)>
  a[i_16] = a_I_lsm.4_2;
  i_6 = i_16 + 1;
  ivtmp.5_12 = ivtmp.5_10 - 1;
  if (ivtmp.5_12 != 0)
    goto <bb 6>;
  else
    goto <bb 8>;

<bb 6>:

<bb 7>:
  # i_16 = PHI <0(2), i_6(6)>
  # ivtmp.5_10 = PHI <4(2), ivtmp.5_12(6)>
  goto <bb 4>;


in outer loop vectorization.  Somehow this PHI isn't processed at all.

While I will fix copyprop further to propagate the zero to its single use
I think the vectorizer shouldn't ICE on this case either.

Ira, can you have a look?

Thanks,
Richard.


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
@ 2011-03-25 18:15 ` irar at il dot ibm.com
  2011-03-27 17:02 ` dominiq at lps dot ens.fr
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: irar at il dot ibm.com @ 2011-03-25 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm.com

--- Comment #1 from Ira Rosen <irar at il dot ibm.com> 2011-03-25 18:04:20 UTC ---
We don't expect a PHI that is neither induction nor reduction as a def stmt of
an operand. I'll try to fix this on Sunday.

Ira


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
  2011-03-25 18:15 ` [Bug tree-optimization/48290] " irar at il dot ibm.com
@ 2011-03-27 17:02 ` dominiq at lps dot ens.fr
  2011-03-28 10:38 ` irar at il dot ibm.com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-03-27 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-27 15:59:56 UTC ---
*** Bug 48300 has been marked as a duplicate of this bug. ***


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
  2011-03-25 18:15 ` [Bug tree-optimization/48290] " irar at il dot ibm.com
  2011-03-27 17:02 ` dominiq at lps dot ens.fr
@ 2011-03-28 10:38 ` irar at il dot ibm.com
  2011-03-28 10:56 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: irar at il dot ibm.com @ 2011-03-28 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Ira Rosen <irar at il dot ibm.com> 2011-03-28 10:30:55 UTC ---
I am going to test this patch. It checks that if we have a phi in outer loop in
the basic block after the inner loop, then this phi is really inner loop's exit
phi, i.e., its operand is defined in the inner loop. 

Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c    (revision 171466)
+++ tree-vect-loop.c    (working copy)
@@ -1184,11 +1184,11 @@ vect_analyze_loop_operations (loop_vec_i
               print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
             }

+          /* Inner-loop loop-closed exit phi in outer-loop vectorization
+             (i.e. a phi in the tail of the outer-loop).  */
           if (! is_loop_header_bb_p (bb))
             {
-              /* inner-loop loop-closed exit phi in outer-loop vectorization
-                 (i.e. a phi in the tail of the outer-loop).
-                 FORNOW: we currently don't support the case that these phis
+              /* FORNOW: we currently don't support the case that these phis
                  are not used in the outerloop (unless it is double reduction,
                  i.e., this phi is vect_reduction_def), cause this case
                  requires to actually do something here.  */
@@ -1202,6 +1202,32 @@ vect_analyze_loop_operations (loop_vec_i
                              "Unsupported loop-closed phi in outer-loop.");
                   return false;
                 }
+
+              /* If PHI is used in the outer loop, we check that its operand
+                 is defined in the inner loop.  */
+              if (STMT_VINFO_RELEVANT_P (stmt_info))
+                {
+                  tree phi_op;
+                  gimple op_def_stmt;
+
+                  if (gimple_phi_num_args (phi) != 1)
+                    return false;
+
+                  phi_op = PHI_ARG_DEF (phi, 0);
+                  if (TREE_CODE (phi_op) != SSA_NAME)
+                    return false;
+
+                  op_def_stmt = SSA_NAME_DEF_STMT (phi_op);
+                  if (!op_def_stmt || !vinfo_for_stmt (op_def_stmt))
+                    return false;
+
+                  if (STMT_VINFO_RELEVANT (vinfo_for_stmt (op_def_stmt))
+                        != vect_used_in_outer
+                      && STMT_VINFO_RELEVANT (vinfo_for_stmt (op_def_stmt))
+                           != vect_used_in_outer_by_reduction)
+                    return false;
+                }
+
               continue;
             }


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-28 10:38 ` irar at il dot ibm.com
@ 2011-03-28 10:56 ` rguenth at gcc dot gnu.org
  2011-03-28 18:36 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-28 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-28 10:38:27 UTC ---
Thanks Ira.


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-03-28 10:56 ` rguenth at gcc dot gnu.org
@ 2011-03-28 18:36 ` dominiq at lps dot ens.fr
  2011-03-29  7:50 ` irar at il dot ibm.com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-03-28 18:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-28 18:26:52 UTC ---
The patch in comment #3 fixes the ICE, but the test still fails:

FAIL: gcc.dg/vect/pr38529.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED" 1

Compiling with -Ofast -ftree-vectorizer-verbose=2 I get

/opt/gcc/_clean/gcc/testsuite/gcc.dg/vect/pr38529.c:11: note: not vectorized:
unsupported data-type
/opt/gcc/_clean/gcc/testsuite/gcc.dg/vect/pr38529.c:6: note: vectorized 0 loops
in function.

With revision 171398 I get

/opt/gcc/_clean/gcc/testsuite/gcc.dg/vect/pr38529.c:10: note: LOOP VECTORIZED.
/opt/gcc/_clean/gcc/testsuite/gcc.dg/vect/pr38529.c:10: note: OUTER LOOP
VECTORIZED.
/opt/gcc/_clean/gcc/testsuite/gcc.dg/vect/pr38529.c:6: note: vectorized 1 loops
in function.

No other test fails in gcc/testsuite/*/vect/* (full test for tonight).


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-03-28 18:36 ` dominiq at lps dot ens.fr
@ 2011-03-29  7:50 ` irar at il dot ibm.com
  2011-03-29 10:03 ` rguenther at suse dot de
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: irar at il dot ibm.com @ 2011-03-29  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Ira Rosen <irar at il dot ibm.com> 2011-03-29 07:04:08 UTC ---
(In reply to comment #5)
> The patch in comment #3 fixes the ICE, but the test still fails:
> 
> FAIL: gcc.dg/vect/pr38529.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED" 1
> 

This is expected, because the patch only prevents vectorization of unexpected
phis. As Richard wrote, copyprop will have to be fixed to propagate the zero.
After that the loop will get vectorized again.


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-03-29  7:50 ` irar at il dot ibm.com
@ 2011-03-29 10:03 ` rguenther at suse dot de
  2011-03-29 11:22 ` irar at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenther at suse dot de @ 2011-03-29 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> 2011-03-29 09:22:15 UTC ---
On Mon, 28 Mar 2011, dominiq at lps dot ens.fr wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48290
> 
> --- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-28 18:26:52 UTC ---
> The patch in comment #3 fixes the ICE, but the test still fails:
> 
> FAIL: gcc.dg/vect/pr38529.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED" 1
> 
> Compiling with -Ofast -ftree-vectorizer-verbose=2 I get
> 
> /opt/gcc/_clean/gcc/testsuite/gcc.dg/vect/pr38529.c:11: note: not vectorized:
> unsupported data-type
> /opt/gcc/_clean/gcc/testsuite/gcc.dg/vect/pr38529.c:6: note: vectorized 0 loops
> in function.

That's expected.  I suppose the testcase is no longer testing what it
was supposed to test (even before, as LIM was applying store-sinking to
the store).


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-03-29 10:03 ` rguenther at suse dot de
@ 2011-03-29 11:22 ` irar at gcc dot gnu.org
  2011-04-15 14:12 ` rguenth at gcc dot gnu.org
  2011-04-15 14:15 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: irar at gcc dot gnu.org @ 2011-03-29 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from irar at gcc dot gnu.org 2011-03-29 10:26:30 UTC ---
Author: irar
Date: Tue Mar 29 10:26:25 2011
New Revision: 171657

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171657
Log:

        PR tree-optimization/48290
        * tree-vect-loop.c (vect_analyze_loop_operations): In outer loop
        vectorization, check that relevant phis in the basic block after 
        the inner loop are really inner loop's exit phis.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-vect-loop.c


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2011-03-29 11:22 ` irar at gcc dot gnu.org
@ 2011-04-15 14:12 ` rguenth at gcc dot gnu.org
  2011-04-15 14:15 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-15 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-15 14:03:26 UTC ---
And fixed.


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

* [Bug tree-optimization/48290] FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072
  2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2011-04-15 14:12 ` rguenth at gcc dot gnu.org
@ 2011-04-15 14:15 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-15 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-15 14:02:50 UTC ---
Author: rguenth
Date: Fri Apr 15 14:02:41 2011
New Revision: 172494

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172494
Log:
2011-04-15  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/48290
    * tree-ssa-copy.c (copy_prop_visit_phi_node): Propagate constants.
    Properly decide inhibiting propagation based on the valueized
    operand.  Do loop-closed SSA form preserving here ...
    (init_copy_prop): ... not here.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-copy.c


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

end of thread, other threads:[~2011-04-15 14:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-25 17:54 [Bug tree-optimization/48290] New: FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072 rguenth at gcc dot gnu.org
2011-03-25 18:15 ` [Bug tree-optimization/48290] " irar at il dot ibm.com
2011-03-27 17:02 ` dominiq at lps dot ens.fr
2011-03-28 10:38 ` irar at il dot ibm.com
2011-03-28 10:56 ` rguenth at gcc dot gnu.org
2011-03-28 18:36 ` dominiq at lps dot ens.fr
2011-03-29  7:50 ` irar at il dot ibm.com
2011-03-29 10:03 ` rguenther at suse dot de
2011-03-29 11:22 ` irar at gcc dot gnu.org
2011-04-15 14:12 ` rguenth at gcc dot gnu.org
2011-04-15 14:15 ` 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).