This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH]: Make PRE handle globals
I have reverted the non-SCCVN parts of this patch.
I do not have time to track this miscompile down right now.
I am also not particularly enthused that it required duplicating decls
to get right. I will probably redo this a different way as part of a
larger rework of some parts of PRE.
(Though if someone wants to track it down beforehand, feel free!).
On 7/6/07, Daniel Berlin <email@example.com> wrote:
One of the longstanding deficiencies of GVNPRE (and FRE) was it's
inability to optimize away duplicate loads from globals, as well as
The attached fixes this. SCCVN knows how to value number globals
properly, which takes care of FRE.
PRE needed a little more work. In order to be able to store different
values on a global at different times, we "unshare" the global locally
when creating it's value expression (this does not affect the original
IR), and have a pointer map for value handles for decl's.
Bootstrapped and regtested on i686-darwin
Committed to mainline
2007-07-06 Daniel Berlin <firstname.lastname@example.org>
* tree-ssa-sccvn.c (expr_has_constants): Handle tcc_declaration.
* tree-vn.c (set_value_handle): Use decl_vh_map for decl value
* tree-flow-inline.h (get_value_handle): Ditto.
* tree-ssa-pre.c (decl_vh_map): New.
(can_value_number_operation): Support DECL_P.
(find_existing_value_expr): Modify to differnetiate between
addressing and top level.
(create_value_handle_for_expr): Handle DECL's.
(make_values_for_phi): Don't insert into PHI_GEN during FRE.
(make_values_for_stmt): Handle DECL's properly.
(init_pre): Reorg to not init useless things during FRE.
* tree-flow.h: Include pointer-set.h.
* Makefile.in (TREE_FLOW_H): Add pointer-set.h