tree-optimization/97650 - fix ICE in vect_get_and_check_slp_defs
authorRichard Biener <rguenther@suse.de>
Mon, 2 Nov 2020 07:59:02 +0000 (08:59 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 2 Nov 2020 10:03:30 +0000 (11:03 +0100)
I was mistaken to treat vect_external_def as only applying to
SSA_NAME defs, so check for that.

2020-11-02  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97650
* tree-vect-slp.c (vect_get_and_check_slp_defs): Check
for SSA_NAME before checking SSA_NAME_IS_DEFAULT_DEF.

* gcc.dg/vect/bb-slp-pr97650.c: New testcase.

gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c [new file with mode: 0644]
gcc/tree-vect-slp.c

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c
new file mode 100644 (file)
index 0000000..f9c91fb
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os -fallow-store-data-races" } */
+
+short a=0;
+unsigned long *volatile *volatile *volatile *b;
+unsigned long *volatile *volatile *volatile **c[7];
+void d() {
+  short e=0;
+  for (; a;) {
+    e = 0;
+    for (; e < 7; e++)
+      c[e] = &b;
+  }
+}
+int main() { return 0; }
index 56dc59e11a668bf05d397f0ad6c1a215ba3ba5f1..d5249196d5eee44427ee3913d2e27137da504cbc 100644 (file)
@@ -530,6 +530,7 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
       if (backedge
          && dts[i] == vect_external_def
          && is_a <bb_vec_info> (vinfo)
+         && TREE_CODE (oprnd) == SSA_NAME
          && !SSA_NAME_IS_DEFAULT_DEF (oprnd)
          && !dominated_by_p (CDI_DOMINATORS,
                              as_a <bb_vec_info> (vinfo)->bbs[0],