This is the mail archive of the 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]

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 <> wrote:
One of the longstanding deficiencies of GVNPRE (and FRE) was it's
inability to optimize away duplicate loads from globals, as well as
hoist them.

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 <>

        * tree-ssa-sccvn.c (expr_has_constants): Handle tcc_declaration.
        (try_to_simplify): Ditto.
        (visit_use): Ditto.
        * 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.
        (decl_node_pool): New.
        (can_value_number_operation): Support DECL_P.
        (can_PRE_operation): Ditto.
        (create_expression_by_pieces): Ditto.
        (find_existing_value_expr): Modify to differnetiate between
        addressing and top level.
        (create_value_handle_for_expr): Handle DECL's.
        (poolify_tree): Ditto.
        (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.
        (fini_pre): Ditto.
        * tree-flow.h: Include pointer-set.h.
        (decl_vh_map): Declare.
        * (TREE_FLOW_H): Add pointer-set.h

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