summaryrefslogtreecommitdiff
path: root/gcc/gimple-match-head.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-07 13:18:07 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-07 13:18:07 +0000
commit8cd9143e12d8fd7c4bc512443ded2475e404d10f (patch)
tree5cc975e1ee19aa16d83a69b02b66bd72b50748e7 /gcc/gimple-match-head.c
parentfabf26080cb4cc3fecd30d409ec9c63f0ec42eff (diff)
downloadgcc-8cd9143e12d8fd7c4bc512443ded2475e404d10f.tar.gz
* match.pd (bit_and (plus/minus (convert @0) (convert @1) mask): New
simplifier to narrow arithmetic. * generic-match-head.c: (types_match, single_use): New functions. * gimple-match-head.c: (types_match, single_use): New functions. * gcc.dg/tree-ssa/shorten-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222877 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-match-head.c')
-rw-r--r--gcc/gimple-match-head.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c
index c7b2f957bac..7b9348b53ec 100644
--- a/gcc/gimple-match-head.c
+++ b/gcc/gimple-match-head.c
@@ -861,3 +861,21 @@ do_valueize (tree (*valueize)(tree), tree op)
return op;
}
+/* Routine to determine if the types T1 and T2 are effectively
+ the same for GIMPLE. */
+
+static inline bool
+types_match (tree t1, tree t2)
+{
+ return types_compatible_p (t1, t2);
+}
+
+/* Return if T has a single use. For GIMPLE, we also allow any
+ non-SSA_NAME (ie constants) and zero uses to cope with uses
+ that aren't linked up yet. */
+
+static inline bool
+single_use (tree t)
+{
+ return TREE_CODE (t) != SSA_NAME || has_zero_uses (t) || has_single_use (t);
+}