public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3250] tree-optimization/102142 - fix typo in loop BB reduc cost adjustment
@ 2021-08-31 10:27 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-08-31 10:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:67927342290c61d7e054430f1d7a7281f1f97fae

commit r12-3250-g67927342290c61d7e054430f1d7a7281f1f97fae
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Aug 31 11:04:51 2021 +0200

    tree-optimization/102142 - fix typo in loop BB reduc cost adjustment
    
    This fixes a typo in the condition guarding the cleanup of the
    visited flag of costed scalar stmts.
    
    2021-08-31  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/102142
            * tree-vect-slp.c (vect_bb_vectorization_profitable_p): Fix
            condition under which to unset the visited flag.
    
            * g++.dg/torture/pr102142.C: New testcase.

Diff:
---
 gcc/testsuite/g++.dg/torture/pr102142.C | 9 +++++++++
 gcc/tree-vect-slp.c                     | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/g++.dg/torture/pr102142.C b/gcc/testsuite/g++.dg/torture/pr102142.C
new file mode 100644
index 00000000000..8e3ea5d96b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr102142.C
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+extern short arr_597[];
+extern bool arr_601[];
+int test_var_13;
+void test(short arr_391[][9][2][2]) {
+  for (int i_60 = 0; i_60 < 11; i_60 += test_var_13)
+    arr_597[22] = arr_601[i_60] = arr_391[0][0][1][4];
+}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 4ca24408249..fa3566f3d06 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -5396,7 +5396,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
 
   /* Unset visited flag.  This is delayed when the subgraph is profitable
      and we process the loop for remaining unvectorized if-converted code.  */
-  if (orig_loop && !profitable)
+  if (!orig_loop || !profitable)
     FOR_EACH_VEC_ELT (scalar_costs, i, cost)
       gimple_set_visited  (cost->stmt_info->stmt, false);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-31 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 10:27 [gcc r12-3250] tree-optimization/102142 - fix typo in loop BB reduc cost adjustment Richard Biener

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).