From b6ed2e2bca54d1d290f553549d28b0c60a0f240f Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 22 May 2020 08:48:04 +0200 Subject: [PATCH] tree-optimization/95248 - fix oversight in SM rewrite This fixes a leftover early out in determining the sequence of stores to materialize. 2020-05-22 Richard Biener PR tree-optimization/95248 * tree-ssa-loop-im.c (sm_seq_valid_bb): Remove bogus early out. * gcc.dg/torture/pr95248.c: New testcase. --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr95248.c | 28 ++++++++++++++++++++++++++ gcc/tree-ssa-loop-im.c | 2 -- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr95248.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 598163590e5..957c1f3c5ef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-05-22 Richard Biener + + PR tree-optimization/95248 + * tree-ssa-loop-im.c (sm_seq_valid_bb): Remove bogus early out. + 2020-05-22 Richard Biener * tree-vectorizer.h (_slp_tree::_slp_tree): New. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6de0c5e8923..1e8ad06f78a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-05-22 Richard Biener + + PR tree-optimization/95248 + * gcc.dg/torture/pr95248.c: New testcase. + 2020-05-21 Patrick Palka PR c++/94038 diff --git a/gcc/testsuite/gcc.dg/torture/pr95248.c b/gcc/testsuite/gcc.dg/torture/pr95248.c new file mode 100644 index 00000000000..f0efcc12b51 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr95248.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +int var_2 = -2013646301; +int var_3 = -1126567434; +unsigned int var_12 = 1; +unsigned int var_19; +unsigned int arr_25 [24] [21] [15] [17] [15] ; + +void __attribute__((noipa)) test() +{ + for (int a = 0; a < 3; a = 42) + for (int b = 0; b < 20; b++) + for (int c = 0; c < 4; c = 4) + for (int d = 0; d < 6; d += 4) + for (int e = 0; e < 4; e += 2) { + arr_25[a][b][c][d][e] = var_2 || var_3; + var_19 = var_12; + } +} + +int main() +{ + test(); + if (var_19 != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 63f4ef8883c..fcca099355a 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -2436,8 +2436,6 @@ sm_seq_valid_bb (class loop *loop, basic_block bb, tree vdef, /* Use the sequence from the first edge and push SMs down. */ for (unsigned i = 0; i < first_edge_seq.length (); ++i) { - if (first_edge_seq[i].second == sm_other) - break; unsigned id = first_edge_seq[i].first; seq.safe_push (first_edge_seq[i]); unsigned new_idx; -- 2.30.2