summaryrefslogtreecommitdiff
path: root/gcc/generic-match-head.c
diff options
context:
space:
mode:
authorglisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-14 14:45:33 +0000
committerglisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-14 14:45:33 +0000
commitb1306f1238f6b0fae75813e12da581ae307a7fad (patch)
tree3f458e1179a5b2faa934d97e293a20431f09ecda /gcc/generic-match-head.c
parent54fef4063d4a5aacf6facbad315e63b219a86a82 (diff)
downloadgcc-b1306f1238f6b0fae75813e12da581ae307a7fad.tar.gz
2015-05-14 Marc Glisse <marc.glisse@inria.fr>
gcc/ * generic-match-head.c (types_match): Handle non-types. * gimple-match-head.c (types_match): Likewise. * match.pd: Remove unnecessary TREE_TYPE for types_match. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223199 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/generic-match-head.c')
-rw-r--r--gcc/generic-match-head.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/generic-match-head.c b/gcc/generic-match-head.c
index efaa2d8b7ce..40dc53f5bf8 100644
--- a/gcc/generic-match-head.c
+++ b/gcc/generic-match-head.c
@@ -71,11 +71,17 @@ along with GCC; see the file COPYING3. If not see
#include "generic-match.h"
/* Routine to determine if the types T1 and T2 are effectively
- the same for GENERIC. */
+ the same for GENERIC. If T1 or T2 is not a type, the test
+ applies to their TREE_TYPE. */
static inline bool
types_match (tree t1, tree t2)
{
+ if (!TYPE_P (t1))
+ t1 = TREE_TYPE (t1);
+ if (!TYPE_P (t2))
+ t2 = TREE_TYPE (t2);
+
return TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2);
}