* [PATCH][match-and-simplify] Other 3-arg call support place
@ 2014-08-18 13:11 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2014-08-18 13:11 UTC (permalink / raw)
To: gcc-patches
Committed.
Richard.
2014-08-18 Richard Biener <rguenther@suse.de>
* gimple-match-head.c (gimple_simplify): Handle calls with
three arguments.
Index: gcc/gimple-match-head.c
===================================================================
--- gcc/gimple-match-head.c (revision 214018)
+++ gcc/gimple-match-head.c (working copy)
@@ -668,6 +693,7 @@ gimple_simplify (gimple stmt,
}
}
else if (is_gimple_call (stmt)
+ /* ??? This way we can't simplify calls with side-effects. */
&& gimple_call_lhs (stmt) != NULL_TREE)
{
tree fn = gimple_call_fn (stmt);
@@ -724,6 +750,35 @@ gimple_simplify (gimple stmt,
ops[1] = arg2;
return gimple_resimplify2 (seq, rcode, type, ops, valueize);
}
+ case 3:
+ {
+ tree arg1 = gimple_call_arg (stmt, 0);
+ if (valueize && TREE_CODE (arg1) == SSA_NAME)
+ {
+ arg1 = valueize (arg1);
+ if (!arg1)
+ return false;
+ }
+ tree arg2 = gimple_call_arg (stmt, 1);
+ if (valueize && TREE_CODE (arg2) == SSA_NAME)
+ {
+ arg2 = valueize (arg2);
+ if (!arg2)
+ return false;
+ }
+ tree arg3 = gimple_call_arg (stmt, 2);
+ if (valueize && TREE_CODE (arg3) == SSA_NAME)
+ {
+ arg3 = valueize (arg3);
+ if (!arg3)
+ return false;
+ }
+ *rcode = DECL_FUNCTION_CODE (decl);
+ ops[0] = arg1;
+ ops[1] = arg2;
+ ops[2] = arg3;
+ return gimple_resimplify3 (seq, rcode, type, ops, valueize);
+ }
default:
return false;
}
@@ -742,3 +797,4 @@ do_valueize (tree (*valueize)(tree), tre
return valueize (op);
return op;
}
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-08-18 13:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-18 13:11 [PATCH][match-and-simplify] Other 3-arg call support place Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).