tree-optimization/95856 fix vect_stmt_dominates_stmt_p at BB region boundary
authorRichard Biener <rguenther@suse.de>
Tue, 23 Jun 2020 11:59:20 +0000 (13:59 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 24 Jun 2020 10:58:45 +0000 (12:58 +0200)
The following adjusts vect_stmt_dominates_stmt_p to honor out-of-region
stmts we run into which have UID -1u.

2020-06-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95856
* tree-vectorizer.c (vect_stmt_dominates_stmt_p): Honor
region marker -1u.

* gcc.dg/vect/pr95856.c: New testcase.

gcc/testsuite/gcc.dg/vect/pr95856.c [new file with mode: 0644]
gcc/tree-vectorizer.c

diff --git a/gcc/testsuite/gcc.dg/vect/pr95856.c b/gcc/testsuite/gcc.dg/vect/pr95856.c
new file mode 100644 (file)
index 0000000..19a86a6
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+typedef struct {
+  float xmin, xmax;
+} rctf;
+
+typedef struct {
+  rctf tot;
+} View2D;
+
+View2D graph_main_area_draw_v2d;
+
+void get_graph_keyframe_extents();
+
+void
+graph_main_area_draw() {
+  get_graph_keyframe_extents();
+  graph_main_area_draw_v2d.tot.xmin -= 10.0f;
+  graph_main_area_draw_v2d.tot.xmax += 10.0f;
+}
index e262ba0..78d9da6 100644 (file)
@@ -752,6 +752,8 @@ vect_stmt_dominates_stmt_p (gimple *s1, gimple *s2)
       if (gsi_stmt (gsi1) == s2)
        return true;
     }
+  if (gimple_uid (gsi_stmt (gsi1)) == -1u)
+    return false;
 
   gimple_stmt_iterator gsi2 = gsi_for_stmt (s2);
   while (gimple_uid (gsi_stmt (gsi2)) == 0)
@@ -762,6 +764,8 @@ vect_stmt_dominates_stmt_p (gimple *s1, gimple *s2)
       if (gsi_stmt (gsi2) == s1)
        return true;
     }
+  if (gimple_uid (gsi_stmt (gsi2)) == -1u)
+    return false;
 
   if (gimple_uid (gsi_stmt (gsi1)) <= gimple_uid (gsi_stmt (gsi2)))
     return true;