tree-optimization/97173 - extend assert in vectorizable_live_operation
authorRichard Biener <rguenther@suse.de>
Wed, 23 Sep 2020 08:42:48 +0000 (10:42 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 23 Sep 2020 10:19:22 +0000 (12:19 +0200)
The condition we're expecting to eventually run into isn't fully
captured by checking for CTORs, instead we can also run into the
CTOR element conversion.

2020-09-23  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97173
* tree-vect-loop.c (vectorizable_live_operation): Extend
assert to also conver element conversions.

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

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

diff --git a/gcc/testsuite/gcc.dg/vect/pr97173.c b/gcc/testsuite/gcc.dg/vect/pr97173.c
new file mode 100644 (file)
index 0000000..fd4a889
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+typedef struct {
+  char *track;
+  char *clocks;
+  char *fm;
+  char *weak;  
+} disk_t;
+
+disk_t disk_update_tlens_d;
+int disk_update_tlens_d_0;
+
+void disk_update_tlens() {
+  disk_update_tlens_d.track = disk_update_tlens_d.clocks =
+      disk_update_tlens_d.track + disk_update_tlens_d_0;
+  disk_update_tlens_d.fm = disk_update_tlens_d.clocks + disk_update_tlens_d_0;
+  disk_update_tlens_d.weak = disk_update_tlens_d.fm;
+  disk_update_tlens_d.track[2] = 5;
+}
index b1a6e1508c7f00f5f369ec873f927f30d673059e..46d126c54bae691d304d3e05618a016724691ed8 100644 (file)
@@ -8345,8 +8345,10 @@ vectorizable_live_operation (vec_info *vinfo,
            if (gimple_code (use_stmt) != GIMPLE_PHI
                && !vect_stmt_dominates_stmt_p (gsi_stmt (*gsi), use_stmt))
              {
-               gcc_assert (is_gimple_assign (use_stmt)
-                           && gimple_assign_rhs_code (use_stmt) == CONSTRUCTOR);
+               enum tree_code code = gimple_assign_rhs_code (use_stmt);
+               gcc_assert (code == CONSTRUCTOR
+                           || code == VIEW_CONVERT_EXPR
+                           || CONVERT_EXPR_CODE_P (code));
                if (dump_enabled_p ())
                  dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                                   "Using original scalar computation for "