This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][LTO] Fix PR45018


On 10-07-21 12:15 , Richard Guenther wrote:
+ struct pointer_map_t *, struct obstack *);

-bool
-gimple_types_compatible_p (tree t1, tree t2, bool for_merging_p)
+static bool
+gtc_visit (tree t1, tree t2, bool for_merging_p,
+	   struct sccs *state,
+	   VEC(type_pair_t, heap) **sccstack,
+	   struct pointer_map_t *sccstate,
+	   struct obstack *sccstate_obstack)

Needs documentation.


+  if (!cstate)
      {
-      /* We are currently comparing this pair of types, assume
-	 that they are the same and let the caller decide.  */
-      return 1;
+      int res;
+      /* Not yet visited.  DFS recurse.  */
+      res = gimple_types_compatible_p_1 (t1, t2, for_merging_p,
+					 sccstack, sccstate, sccstate_obstack);
+      if (!cstate)
+	cstate = (struct sccs *)* pointer_map_contains (sccstate, p);
+      state->low = MIN (state->low, cstate->low);
+      /* If the type is no longer on the SCC stack and thus is not part
+	 of the parents SCC mix in its hash value.  Otherwise we will
+	 ignore the type for hashing purposes and return the unaltered
+	 hash value.  */
+      if (!cstate->on_sccstack)
+	return res;
      }
+  if (cstate->dfsnum<  state->dfsnum
+&&  cstate->on_sccstack)
+    state->low = MIN (cstate->dfsnum, state->low);
+
+  /* We are part of our parents SCC, skip this entry and return true.  */
+  return 1;

s/1/true/



+}
+
+/* Return 1 iff T1 and T2 are structurally identical.
+   Otherwise, return 0.  */
+
+static bool
+gimple_types_compatible_p_1 (tree t1, tree t2, bool for_merging_p,
+			     VEC(type_pair_t, heap) **sccstack,
+			     struct pointer_map_t *sccstate,
+			     struct obstack *sccstate_obstack)

Arguments need documentation.




/* Common exit path for types that are not compatible. */ different_types: - p->same_p = 0; - return 0; + state->hash/*same_p*/ = 0; + goto pop;

    /* Common exit path for types that are compatible.  */
  same_types:
-  p->same_p = 1;
-  return 1;
+  state->hash/*same_p*/ = 1;

Why the /*same_p*/ comment? Better add a 'same_p' field to 'state' instead of overloading the field (or make a union?).


Change all the return 0/1 to return false/true? Or make the functions return int, I guess.

OK with those changes.

Seems to me that this should give some speedup to type comparison, right?


Diego.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]