aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-match-head.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-07-26 11:35:45 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-07-26 11:35:45 +0000
commit4f450a2b1022124194097e39b3b1caca1d5dc2bc (patch)
tree952eff26eae11dd5471be7d46169494d5b16a908 /gcc/gimple-match-head.c
parente17114487df7f90d8e015efad697a3cc93845b90 (diff)
downloadgcc-4f450a2b1022124194097e39b3b1caca1d5dc2bc.zip
gcc-4f450a2b1022124194097e39b3b1caca1d5dc2bc.tar.gz
gcc-4f450a2b1022124194097e39b3b1caca1d5dc2bc.tar.bz2
gimple-match-head.c (do_valueize): Return OP if valueize returns NULL_TREE.
2017-07-26 Richard Biener <rguenther@suse.de> * gimple-match-head.c (do_valueize): Return OP if valueize returns NULL_TREE. (get_def): New helper to get at the def stmt of a SSA name if valueize allows. * genmatch.c (dt_node::gen_kids_1): Use get_def instead of do_valueize to get at the def stmt. (dt_operand::gen_gimple_expr): Simplify do_valueize calls. * gcc/testsuite/gcc.dg/pr70920-2.c: Adjust for transform already happening in ccp1. * gcc/testsuite/gcc.dg/pr70920-4.c: Likewise. From-SVN: r250565
Diffstat (limited to 'gcc/gimple-match-head.c')
-rw-r--r--gcc/gimple-match-head.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c
index 5f6aa273..8ad1f8c 100644
--- a/gcc/gimple-match-head.c
+++ b/gcc/gimple-match-head.c
@@ -779,10 +779,25 @@ inline tree
do_valueize (tree (*valueize)(tree), tree op)
{
if (valueize && TREE_CODE (op) == SSA_NAME)
- return valueize (op);
+ {
+ tree tem = valueize (op);
+ if (tem)
+ return tem;
+ }
return op;
}
+/* Helper for the autogenerated code, get at the definition of NAME when
+ VALUEIZE allows that. */
+
+inline gimple *
+get_def (tree (*valueize)(tree), tree name)
+{
+ if (valueize && ! valueize (name))
+ return NULL;
+ return SSA_NAME_DEF_STMT (name);
+}
+
/* Routine to determine if the types T1 and T2 are effectively
the same for GIMPLE. If T1 or T2 is not a type, the test
applies to their TREE_TYPE. */