diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-10-21 20:11:33 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-10-21 20:11:33 +0000 |
commit | 6a75d560c855081ddb8147bf6cec378cda55901b (patch) | |
tree | 468c0e4a1b28417766a235b583ad1633ef8b346f /gcc/fold-const.c | |
parent | 77ec8b8c0f75a5f0b953e5dd6696e6b07253f21b (diff) | |
download | gcc-6a75d560c855081ddb8147bf6cec378cda55901b.zip gcc-6a75d560c855081ddb8147bf6cec378cda55901b.tar.gz gcc-6a75d560c855081ddb8147bf6cec378cda55901b.tar.bz2 |
Add a pass to back-propagate use information
This patch adds a pass that collects information that is common to
all uses of an SSA name X and back-propagates that information up
the statements that generate X. The general idea is to use the
information to simplify instructions (rather than a pure DCE) so
I've simply called it gimple-ssa-backprop.c, to go with
tree-ssa-forwprop.c.
At the moment the only use of the pass is to remove unnecessary
sign operations, so that it's effectively a global version of
fold_strip_sign_ops. I'm hoping it could be extended in future
to record which bits of an integer are significant. There are
probably other potential uses too.
A later patch gets rid of fold_strip_sign_ops.
Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
gcc/
* doc/invoke.texi (-fdump-tree-backprop, -fssa-backprop): Document.
* Makefile.in (OBJS): Add gimple-ssa-backprop.o.
* common.opt (fssa-backprop): New option.
* fold-const.h (negate_mathfn_p): Declare.
* fold-const.c (negate_mathfn_p): Make public.
* timevar.def (TV_TREE_BACKPROP): New.
* tree-pass.h (make_pass_backprop): Declare.
* passes.def (pass_backprop): Add.
* gimple-ssa-backprop.c: New file.
gcc/testsuite/
* gcc.dg/tree-ssa/backprop-1.c, gcc.dg/tree-ssa/backprop-2.c,
gcc.dg/tree-ssa/backprop-3.c, gcc.dg/tree-ssa/backprop-4.c,
gcc.dg/tree-ssa/backprop-5.c, gcc.dg/tree-ssa/backprop-6.c: New tests.
From-SVN: r229139
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 197383d..dff1d55 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -112,7 +112,6 @@ enum comparison_code { COMPCODE_TRUE = 15 }; -static bool negate_mathfn_p (enum built_in_function); static bool negate_expr_p (tree); static tree negate_expr (tree); static tree split_tree (tree, enum tree_code, tree *, tree *, tree *, int); @@ -321,7 +320,7 @@ fold_overflow_warning (const char* gmsgid, enum warn_strict_overflow_code wc) /* Return true if the built-in mathematical function specified by CODE is odd, i.e. -f(x) == f(-x). */ -static bool +bool negate_mathfn_p (enum built_in_function code) { switch (code) |