+2019-02-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87609
+ * tree-core.h (tree_base): Document special clique values.
+ * tree-inline.c (remap_dependence_clique): Do not use the
+ special clique value of one.
+ (maybe_set_dependence_info): Use clique one.
+ (clear_dependence_clique): New callback.
+ (compute_dependence_clique): Clear clique one from all refs
+ before assigning it (again).
+
2019-02-21 Martin Sebor <msebor@redhat.com>
* doc/extend.texi (__clear_cache): Correct signature.
expression trees and specify known data non-dependences. For
two memory references in a function they are known to not
alias if dependence_info.clique are equal and dependence_info.base
- are distinct. */
+ are distinct. Clique number zero means there is no information,
+ clique number one is populated from function global information
+ and thus needs no remapping on transforms like loop unrolling. */
struct {
unsigned short clique;
unsigned short base;
bool existed;
unsigned short &newc = id->dependence_map->get_or_insert (clique, &existed);
if (!existed)
- newc = ++cfun->last_clique;
+ {
+ /* Clique 1 is reserved for local ones set by PTA. */
+ if (cfun->last_clique == 0)
+ cfun->last_clique = 1;
+ newc = ++cfun->last_clique;
+ }
return newc;
}
if (MR_DEPENDENCE_CLIQUE (base) == 0)
{
if (clique == 0)
- clique = ++cfun->last_clique;
+ {
+ if (cfun->last_clique == 0)
+ cfun->last_clique = 1;
+ clique = 1;
+ }
if (restrict_var->ruid == 0)
restrict_var->ruid = ++last_ruid;
MR_DEPENDENCE_CLIQUE (base) = clique;
return false;
}
+/* Clear dependence info for the clique DATA. */
+
+static bool
+clear_dependence_clique (gimple *, tree base, tree, void *data)
+{
+ unsigned short clique = (uintptr_t)data;
+ if ((TREE_CODE (base) == MEM_REF
+ || TREE_CODE (base) == TARGET_MEM_REF)
+ && MR_DEPENDENCE_CLIQUE (base) == clique)
+ {
+ MR_DEPENDENCE_CLIQUE (base) = 0;
+ MR_DEPENDENCE_BASE (base) = 0;
+ }
+
+ return false;
+}
+
/* Compute the set of independend memory references based on restrict
tags and their conservative propagation to the points-to sets. */
static void
compute_dependence_clique (void)
{
+ /* First clear the special "local" clique. */
+ basic_block bb;
+ if (cfun->last_clique != 0)
+ FOR_EACH_BB_FN (bb, cfun)
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ walk_stmt_load_store_ops (stmt, (void *)(uintptr_t) 1,
+ clear_dependence_clique,
+ clear_dependence_clique);
+ }
+
unsigned short clique = 0;
unsigned short last_ruid = 0;
bitmap rvars = BITMAP_ALLOC (NULL);