tree-optimization/99510 - fix type reuse of build_aligned_type

The fix for PR94775 added more strict checking for type reuse
to check_aligned_type, specifically matching TYPE_USER_ALIGN.
But then build_aligned_type sets TYPE_USER_ALIGN on the built
variant so if the type we build an aligned variant for does not
have TYPE_USER_ALIGN we'll never re-use the newly created aligned
variant.  This results in ~35000 identical variants being created
for polyhedron doduc.

The following instead checks that the candidate has TYPE_USER_ALIGN set.

2021-03-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99510
	* tree.c (check_aligned_type): Check that the candidate
	has TYPE_USER_ALIGN set instead of matching with the
	original type.
This commit is contained in:
Richard Biener 2021-03-10 11:57:21 +01:00
parent 47403a0eef
commit 6ceb712e26
1 changed files with 3 additions and 1 deletions

View File

@ -6609,7 +6609,9 @@ check_aligned_type (const_tree cand, const_tree base, unsigned int align)
&& TYPE_CONTEXT (cand) == TYPE_CONTEXT (base)
/* Check alignment. */
&& TYPE_ALIGN (cand) == align
&& TYPE_USER_ALIGN (cand) == TYPE_USER_ALIGN (base)
/* Check this is a user-aligned type as build_aligned_type
would create. */
&& TYPE_USER_ALIGN (cand)
&& attribute_list_equal (TYPE_ATTRIBUTES (cand),
TYPE_ATTRIBUTES (base))
&& check_lang_type (cand, base));