]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/tree-ssa.c
Update copyright years.
[thirdparty/gcc.git] / gcc / tree-ssa.c
index 8e3aec1e0a695e8fb74c7a191a41ae50200be435..dbff604514574959072ba675b8b59aca62728b0f 100644 (file)
@@ -1,5 +1,5 @@
 /* Miscellaneous SSA utility functions.
-   Copyright (C) 2001-2019 Free Software Foundation, Inc.
+   Copyright (C) 2001-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -559,20 +559,25 @@ release_defs_bitset (bitmap toremove)
 
   /* Performing a topological sort is probably overkill, this will
      most likely run in slightly superlinear time, rather than the
-     pathological quadratic worst case.  */
+     pathological quadratic worst case.
+     But iterate from max SSA name version to min one because
+     that mimics allocation order during code generation behavior best.
+     Use an array for this which we compact on-the-fly with a NULL
+     marker moving towards the end of the vector.  */
+  auto_vec<tree, 16> names;
+  names.reserve (bitmap_count_bits (toremove) + 1);
+  names.quick_push (NULL_TREE);
+  EXECUTE_IF_SET_IN_BITMAP (toremove, 0, j, bi)
+    names.quick_push (ssa_name (j));
+
+  bitmap_tree_view (toremove);
   while (!bitmap_empty_p (toremove))
     {
-      unsigned to_remove_bit = -1U;
-      EXECUTE_IF_SET_IN_BITMAP (toremove, 0, j, bi)
+      j = names.length () - 1;
+      for (unsigned i = names.length () - 1; names[i];)
        {
-         if (to_remove_bit != -1U)
-           {
-             bitmap_clear_bit (toremove, to_remove_bit);
-             to_remove_bit = -1U;
-           }
-
          bool remove_now = true;
-         tree var = ssa_name (j);
+         tree var = names[i];
          gimple *stmt;
          imm_use_iterator uit;
 
@@ -617,16 +622,26 @@ release_defs_bitset (bitmap toremove)
                  gsi_remove (&gsi, true);
                  release_defs (def);
                }
-
-             to_remove_bit = j;
+             bitmap_clear_bit (toremove, SSA_NAME_VERSION (var));
            }
+         else
+           --i;
+         if (--j != i)
+           names[i] = names[j];
        }
-      if (to_remove_bit != -1U)
-       bitmap_clear_bit (toremove, to_remove_bit);
     }
-
+  bitmap_list_view (toremove);
 }
 
+/* Disable warnings about missing quoting in GCC diagnostics for
+   the verification errors.  Their format strings don't follow GCC
+   diagnostic conventions and the calls are ultimately followed by
+   one to internal_error.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Verify virtual SSA form.  */
 
 bool
@@ -1193,6 +1208,9 @@ err:
   internal_error ("verify_ssa failed");
 }
 
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
 
 /* Initialize global DFA and SSA structures.  */
 
@@ -1881,6 +1899,11 @@ execute_update_addresses_taken (void)
                    && bitmap_bit_p (suitable_for_renaming, DECL_UID (sym))
                    && VECTOR_TYPE_P (TREE_TYPE (sym))
                    && TYPE_MODE (TREE_TYPE (sym)) != BLKmode
+                   /* If it is a full replacement we can do better below.  */
+                   && maybe_ne (wi::to_poly_offset
+                                  (TYPE_SIZE_UNIT (TREE_TYPE (lhs))),
+                                wi::to_poly_offset
+                                   (TYPE_SIZE_UNIT (TREE_TYPE (sym))))
                    && known_ge (mem_ref_offset (lhs), 0)
                    && known_gt (wi::to_poly_offset
                                   (TYPE_SIZE_UNIT (TREE_TYPE (sym))),
@@ -1998,9 +2021,7 @@ execute_update_addresses_taken (void)
                            /* In ASAN_MARK (UNPOISON, &b, ...) the variable
                               is uninitialized.  Avoid dependencies on
                               previous out of scope value.  */
-                           tree clobber
-                             = build_constructor (TREE_TYPE (var), NULL);
-                           TREE_THIS_VOLATILE (clobber) = 1;
+                           tree clobber = build_clobber (TREE_TYPE (var));
                            gimple *g = gimple_build_assign (var, clobber);
                            gsi_replace (&gsi, g, GSI_SAME_STMT);
                          }