+/* Helper for init_alias_info. Reset existing aliasing information. */
+
+static void
+reset_alias_info (void)
+{
+ referenced_var_iterator rvi;
+ tree var;
+ unsigned i;
+ bitmap active_nmts, all_nmts;
+
+ /* Clear the set of addressable variables. We do not need to clear
+ the TREE_ADDRESSABLE bit on every symbol because we are going to
+ re-compute addressability here. */
+ bitmap_clear (gimple_addressable_vars (cfun));
+
+ active_nmts = BITMAP_ALLOC (&alias_bitmap_obstack);
+ all_nmts = BITMAP_ALLOC (&alias_bitmap_obstack);
+
+ /* Clear flow-insensitive alias information from each symbol. */
+ FOR_EACH_REFERENCED_VAR (var, rvi)
+ {
+ if (is_gimple_reg (var))
+ continue;
+
+ if (MTAG_P (var))
+ MTAG_ALIASES (var) = NULL;
+
+ /* Memory partition information will be computed from scratch. */
+ if (TREE_CODE (var) == MEMORY_PARTITION_TAG)
+ MPT_SYMBOLS (var) = NULL;
+
+ /* Collect all the name tags to determine if we have any
+ orphaned that need to be removed from the IL. A name tag
+ will be orphaned if it is not associated with any active SSA
+ name. */
+ if (TREE_CODE (var) == NAME_MEMORY_TAG)
+ bitmap_set_bit (all_nmts, DECL_UID (var));
+
+ /* Since we are about to re-discover call-clobbered
+ variables, clear the call-clobbered flag. Variables that
+ are intrinsically call-clobbered (globals, local statics,
+ etc) will not be marked by the aliasing code, so we can't
+ remove them from CALL_CLOBBERED_VARS.
+
+ NB: STRUCT_FIELDS are still call clobbered if they are for a
+ global variable, so we *don't* clear their call clobberedness
+ just because they are tags, though we will clear it if they
+ aren't for global variables. */
+ if (TREE_CODE (var) == NAME_MEMORY_TAG
+ || TREE_CODE (var) == SYMBOL_MEMORY_TAG
+ || TREE_CODE (var) == MEMORY_PARTITION_TAG
+ || !is_global_var (var))
+ clear_call_clobbered (var);
+ }
+
+ /* Clear flow-sensitive points-to information from each SSA name. */
+ for (i = 1; i < num_ssa_names; i++)
+ {
+ tree name = ssa_name (i);
+
+ if (!name || !POINTER_TYPE_P (TREE_TYPE (name)))
+ continue;
+
+ if (SSA_NAME_PTR_INFO (name))
+ {
+ struct ptr_info_def *pi = SSA_NAME_PTR_INFO (name);
+
+ /* Clear all the flags but keep the name tag to
+ avoid creating new temporaries unnecessarily. If
+ this pointer is found to point to a subset or
+ superset of its former points-to set, then a new
+ tag will need to be created in create_name_tags. */
+ pi->pt_anything = 0;
+ pi->pt_null = 0;
+ pi->value_escapes_p = 0;
+ pi->is_dereferenced = 0;
+ if (pi->pt_vars)
+ bitmap_clear (pi->pt_vars);
+
+ /* Add NAME's name tag to the set of active tags. */
+ if (pi->name_mem_tag)
+ bitmap_set_bit (active_nmts, DECL_UID (pi->name_mem_tag));
+ }
+ }
+
+ /* Name memory tags that are no longer associated with an SSA name
+ are considered stale and should be removed from the IL. All the
+ name tags that are in the set ALL_NMTS but not in ACTIVE_NMTS are
+ considered stale and marked for renaming. */
+ bitmap_and_compl_into (all_nmts, active_nmts);
+ mark_set_for_renaming (all_nmts);
+
+ BITMAP_FREE (all_nmts);
+ BITMAP_FREE (active_nmts);
+}
+
+