This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] Do alias analysis after SSA. Improvements to PR8361.


This is part of some aliasing changes that I am playing with.  It
happens to provide some improvements on its own and it's largely
independent from the rest.

The basic idea is to not do alias analysis until we have done some basic
scalar cleanups to the code.  This essentially mean that we compute
aliases *after* addresses have been propagated and folded into pointer
dereferences and some other simple cleanup passes have run (ie, DOM1 and
DCE1).

To allow optimization passes to run without aliasing information,
get_stmt_operands will simply mark the statement as having volatile
operands when it finds an INDIRECT_REF and/or a reference to an
addressable variable.  This allows passes like DOM and DCE to run only
on real operands without modifications.  In general, passes do (and
should) leave statements alone when they have volatile operands, so this
should allow us to move the aliasing pass up and down the pipeline.

Although the patch adds one additional call to DOM and another to DCE,
compile times and memory usage are down.  For instance, on
generate-3.4.ii (PR 8361), we are now 8% faster (55s down from 60s) and
allocate 13% less memory (236Mb down from 270Mb).  We also generate
smaller code (about 1% smaller, mostly because the additional DOM/DCE
run I suspect).

On the collection of .i/.ii files from a typical bootstrap, the tree
optimizers are about 15% faster (which translates to a 2% improvement
overall).  The passes where we are now significantly faster are:

					Before	Now
 tree alias analysis + must-alias	1.94	1.04	+47%
 tree PHI insertion			4.24	1.79	+57%
 tree SSA rewrite			3.40	2.88	+15%
 tree SSA other				11.01	7.10	+35%
 tree CCP				6.39	1.99	+68%


Bootstrapped and tested x86, amd64 and ia64.


Diego.


	* Makefile.in (OBJS-common): Remove tree-must-alias.o
	(tree-must-alias.o): Remove.
	* common.opt (ftree-must-alias): Remove.
	* flags.h (flag_tree_must_alias): Remove.  Update all users.
	* timevar.def (TV_TREE_MUST_ALIAS): Remove.
	* toplev.c (f_options): Remove entry for -ftree-must-alias.
	* tree-alias-common.c (local_alias_vars): Add GTY marker.
	(local_alias_varnums): Likewise.
	* tree-dfa.c (aliases_computed_p): Declare.
	(dump_variable): Show variable UID and dereferenced bits.
	(compute_may_aliases): Add arguments 'vars_to_rename' and 'phase'.
	Do not call create_alias_vars.
	Call promote_call_clobbered_vars
	Do debugging dumps.
	Set 'aliases_computed_p' to true before returning.
	(create_memory_tags): Call may_be_aliased.
	Mark new memory tags for renaming.
	(compute_alias_sets): Don't do debugging dumps.
	(find_variable_in): Move from tree-must-alias.c
	(remove_element_from): Likewise.
	(find_addressable_vars): Likewise
	(promote_call_clobbered_vars): New.
	(get_memory_tag_for): Mark the tag volatile if the pointed-to type
	is volatile.
	* tree-dump.c (dump_files): Remove entry for tree-mustalias.
	Add entries for tree-ssa7, tree-dom3 and tree-dce3.
	* tree-flow-inline.h (may_be_aliased): New.
	* tree-flow.h (may_be_aliased): Declare.
	(aliases_computed_p): Declare.
	(tree_compute_must_alias): Remove.
	* tree-must-alias.c: Remove.
	* tree-optimize.c: Include tree-alias-common.h.
	(optimize_function_tree): Call create_alias_vars before going into
	SSA form.
	Do not compute aliases until after the first DOM and DCE passes.
	Run DOM and DCE once more after computing may-aliases.
	* tree-ssa-dom.c (propagate_copy): Merge the dereferenced bit flags
	when copy propagating pointers.
	* tree-ssa-operands.c (get_stmt_operands): Assume that the
	statement has no volatile operands.
	(get_expr_operands): When processing an INDIRECT_REF expressions,
	mark the statement as having volatile operands if aliases have not
	been computed.
	(add_stmt_operand): If the variable may be aliased and aliasing has
	not been computed yet, mark the statement as having volatile
	operands.
	* tree-ssa.c (init_tree_ssa): Set aliases_computed_p to false.
	(delete_tree_ssa): Likewise.
	* tree.h (tree_dump_index): Remove TDI_mustalias.
	Add TDI_dom_3, TDI_ssa_7 and TDI_dce_3.
	* doc/invoke.texi: Remove must-alias documentation.


testsuite/ChangeLog.tree-ssa:

	* testsuite/gcc.dg/tree-ssa/20030530-2.c: Adjust dump file patterns.
	* testsuite/gcc.dg/tree-ssa/20030611-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030703-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030703-2.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030708-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030709-2.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030709-3.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030710-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030711-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030711-2.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030711-3.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030714-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030714-2.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030729-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030730-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030730-2.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030731-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-10.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-11.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-2.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-3.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-4.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-5.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-6.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-7.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-8.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-9.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030808-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030814-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030814-2.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030814-3.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030814-4.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030814-5.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030814-6.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030814-7.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030815-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030922-1.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/20030807-1.c: Likewise.
	Fix test to avoid dereferencing a NULL pointer.

Attachment: 20040107-new-aliasing.diff.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]