This is the mail archive of the
mailing list for the GCC project.
Re: Rewrite lto-symtab to work on symbol table
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Sun, 25 Nov 2012 14:48:32 -0800
- Subject: Re: Rewrite lto-symtab to work on symbol table
- References: <20120918133545.GA15008@kam.mff.cuni.cz> <20120924155046.GA5262@virgil.arch.suse.de> <CAMe9rOrVwKN3tjh-+_ZSWKa5EXPFom+N_CNpDhgQiTtLx9025g@mail.gmail.com> <CAMe9rOq0HH_N6a7AswhP9EKsqe_1GMHZYRQt=QsVLY7YnRdtxA@mail.gmail.com>
On Sun, Nov 25, 2012 at 9:55 AM, H.J. Lu <email@example.com> wrote:
> On Mon, Sep 24, 2012 at 9:10 AM, H.J. Lu <firstname.lastname@example.org> wrote:
>> On Mon, Sep 24, 2012 at 8:50 AM, Martin Jambor <email@example.com> wrote:
>>> On Tue, Sep 18, 2012 at 03:35:45PM +0200, Jan Hubicka wrote:
>>>> this patch reorganize lto-symtab to work across symtab's symbol table instead
>>>> of building its own. This simplifies things a bit and with the previous
>>>> changes it is rather straighforward - i.e. replace all uses of
>>>> lto_symtab_entry_t by symtab_node.
>>>> There are few differences in between the symtab as built by lto-symtab and
>>>> our symbol table. In one direction the declarations that are not going to be
>>>> output to final assembly (i.e. are used by debug info and such) are not in
>>>> symbol table and consequentely they no longer get merged. I think this is fine.
>>>> Other difference is that symbol table contains some symbols that are not really
>>>> symbols in classical definition - such as inline clones or functions held in
>>>> table only for purposes of materialization. I added symtab_real_symbol_p
>>>> predicate for this. It would make more sense to exclude those from the
>>>> assembler name hash and drop checks I added to lto-symtab.c. I plan to work on
>>>> this incrementally - it is not completely trivial. The symbol can become
>>>> non-real in several ways and it will need bit of work to get this consistent.
>>>> Bootstrapped/regtested x86_64-linux, tested by building Mozilla, Qt and other
>>>> stuff with LTO. OK?
>>>> * symtab.c (insert_to_assembler_name_hash): Do not insert
>>>> register vars.
>>>> (unlink_from_assembler_name_hash): NULL out pointers of unlinked
>>>> (symtab_prevail_in_asm_name_hash): New.
>>>> (symtab_initialize_asm_name_hash): Break out from ...
>>>> (symtab_node_for_asm): ... here.
>>>> (dump_symtab_base): Dump LTO file data.
>>>> (verify_symtab_base): Register vars are not in symtab.
>>>> * cgraph.h (symtab_initialize_asm_name_hash,
>>>> symtab_prevail_in_asm_name_hash): New functions.
>>>> (symtab_real_symbol_p): New inline.
>>>> * lto-symtab.c: Do not include gt-lto-symtab.h.
>>>> (lto_symtab_entry_def): Remove.
>>>> (lto_symtab_entry_t): Remove.
>>>> (lto_symtab_identifiers): Remove.
>>>> (lto_symtab_free): Remove.
>>>> (lto_symtab_entry_hash): Remove.
>>>> (lto_symtab_entry_eq): Remove.
>>>> (lto_symtab_entry_marked_p): Remove.
>>>> (lto_symtab_maybe_init_hash_table): Remove.
>>>> (resolution_guessed_p, set_resolution_guessed): New functions.
>>>> (lto_symtab_register_decl): Only set resolution info.
>>>> (lto_symtab_get, lto_symtab_get_resolution): Remove.
>>>> (lto_symtab_merge): Reorg to work across symtab; do nothing if decls
>>>> are same.
>>>> (lto_symtab_resolve_replaceable_p): Reorg to work on symtab.
>>>> (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can
>>>> (lto_symtab_resolve_symbols): Reorg to work on symtab.
>>>> (lto_symtab_merge_decls_2): Likewise.
>>>> (lto_symtab_merge_decls_1): Likewise; add debug dumps.
>>>> (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage.
>>>> (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab.
>>>> (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage.
>>>> (lto_symtab_prevailing_decl): Rewrite to lookup into symtab.
>>>> * lto-streaer.h (lto_symtab_free): Remove.
>>>> * lto-cgraph.c (add_references): Cleanup.
>>>> * varpool.c (varpool_assemble_decl): Skip hard regs.
>>>> * lto.c (lto_materialize_function): Update confused comment.
>>>> (read_cgraph_and_symbols): Do not free symtab.
>>> Unfortunately, this patch breaks SPEC2006 povray LTO build for me.
>>> I'm getting:
>>> In file included from :168:0:
>>> lighting.cpp: In function 'InitMallocPools':
>>> lighting.cpp:5971:13: error: address taken, but ADDRESSABLE bit not set
>>> static void InitMallocPools(void)
>>> PHI argument
>>> for PHI node
>>> _191 = PHI <&Frame.Number_Of_Light_Sources(100), &D.7040(101)>
>>> lighting.cpp:5971:13: internal compiler error: verify_ssa failed
>>> I'm currently a bit too busy to try to reduce this, I hope you'll be
>>> able to reproduce the issue yourself easily though. If not, ping me
>>> on IRC.
>> Many of SPEC CPU 2K/2006 benchmarks failed with LTO:
> This patch breaks external array access:
It also destroyed DWARF debug info on data: