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
Showing
- gcc/ChangeLog 12 additions, 0 deletionsgcc/ChangeLog
- gcc/Makefile.in 1 addition, 0 deletionsgcc/Makefile.in
- gcc/common.opt 4 additions, 0 deletionsgcc/common.opt
- gcc/doc/invoke.texi 19 additions, 4 deletionsgcc/doc/invoke.texi
- gcc/fold-const.c 1 addition, 2 deletionsgcc/fold-const.c
- gcc/fold-const.h 1 addition, 0 deletionsgcc/fold-const.h
- gcc/gimple-ssa-backprop.c 956 additions, 0 deletionsgcc/gimple-ssa-backprop.c
- gcc/passes.def 1 addition, 0 deletionsgcc/passes.def
- gcc/testsuite/ChangeLog 6 additions, 0 deletionsgcc/testsuite/ChangeLog
- gcc/testsuite/gcc.dg/tree-ssa/backprop-1.c 22 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/backprop-1.c
- gcc/testsuite/gcc.dg/tree-ssa/backprop-2.c 21 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/backprop-2.c
- gcc/testsuite/gcc.dg/tree-ssa/backprop-3.c 21 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/backprop-3.c
- gcc/testsuite/gcc.dg/tree-ssa/backprop-4.c 21 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/backprop-4.c
- gcc/testsuite/gcc.dg/tree-ssa/backprop-5.c 20 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/backprop-5.c
- gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c 30 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
- gcc/timevar.def 1 addition, 0 deletionsgcc/timevar.def
- gcc/tree-pass.h 1 addition, 0 deletionsgcc/tree-pass.h
Loading
Please register or sign in to comment