aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr113205.c19
-rw-r--r--gcc/tree-vect-slp.cc4
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr113205.c b/gcc/testsuite/gcc.dg/torture/pr113205.c
new file mode 100644
index 0000000..edfba7f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr113205.c
@@ -0,0 +1,19 @@
+char a;
+char *b, *c;
+int d, e, f, g, h;
+int *i;
+
+void
+foo (void)
+{
+ unsigned p;
+ d = i[0];
+ e = i[1];
+ f = i[2];
+ g = i[3];
+ p = d * b[0];
+ p += f * c[h];
+ p += e * b[h];
+ p += g * c[h];
+ a = (p + 8000) >> (__SIZEOF_INT__ * __CHAR_BIT__ / 2);
+}
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 7cf9504..895f4f7 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -5034,6 +5034,10 @@ vect_optimize_slp_pass::forward_cost (graph_edge *ud, unsigned int from_node_i,
cost.split (from_partition.out_degree);
cost.add_serial_cost (edge_cost);
}
+ else if (from_partition.layout == 0)
+ /* We must allow the source partition to have layout 0 as a fallback,
+ in case all other options turn out to be impossible. */
+ return cost;
/* Take the minimum of that cost and the cost that applies if
FROM_PARTITION instead switches to TO_LAYOUT_I. */