abidiff: speed up with performance hack

The function types_have_similar_structure is used during comparisons.
It is called by and calls the main equality functions, possibly
resulting in a multiplication of the cost of comparison.

This is a convenient place to add some memoisation to avoid at least
some of the duplicate calls. This is safe only if pointer addresses
are never reused.

	* src/abg-ir.cc (types_have_similar_structure): In the wrapper
	overload, check for calls with the same (pointer) arguments.
	Assert there is no identical call in progress. Return any
	known result. Cache newly determined results.

Bug: 215577137
Change-Id: I91078cf052ebab5dce0a2d388d84e393aa704d67
Signed-off-by: Giuliano Procida <gprocida@google.com>
1 file changed