From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23487 invoked by alias); 27 Apr 2009 02:40:20 -0000 Received: (qmail 23478 invoked by uid 22791); 27 Apr 2009 02:40:18 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from rv-out-0708.google.com (HELO rv-out-0708.google.com) (209.85.198.244) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Apr 2009 02:40:13 +0000 Received: by rv-out-0708.google.com with SMTP id l33so1420820rvb.56 for ; Sun, 26 Apr 2009 19:40:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.33.19 with SMTP id l19mr1053702wfj.30.1240800010784; Sun, 26 Apr 2009 19:40:10 -0700 (PDT) In-Reply-To: References: <49EE0F0C.1090101@redhat.com> Date: Mon, 27 Apr 2009 05:47:00 -0000 Message-ID: <6dc9ffc80904261940rd21c92cq3eb3119d7ab46687@mail.gmail.com> Subject: Re: [RFA] expand from SSA form (1/2) From: "H.J. Lu" To: Michael Matz Cc: gcc-patches@gcc.gnu.org, Andrew MacLeod , Andrey Belevantsev Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg02079.txt.bz2 On Wed, Apr 22, 2009 at 9:42 AM, Michael Matz wrote: > On Wed, 22 Apr 2009, Michael Matz wrote: > >> I'll soon send a new version of the patch that fixes all problems and >> testcases I encountered. > > Like so. =A0This is the full patch, i.e. including the cleanups, but > excluding the testsuite changes. =A0It should incorporate all feedback. > Compared to the last version it adds comments for new functions, fixes > muflap2, and generally some other minor problems showing when I started > testing Ada and a bug reported by Andrey. > > This patch (plus testsuite changes) was bootstrapped with Ada on > x86_64-linux. =A0There are no testsuite regressions: > FAIL: gcc.dg/tree-prof/bb-reorg.c compilation, =A0-fprofile-use -D_PROFIL= E_USE > FAIL: gcc.dg/tree-prof/pr34999.c compilation, =A0-fprofile-use -D_PROFILE= _USE > FAIL: gcc.target/i386/avx-vmovntdq-256-1.c (test for excess errors) > FAIL: gcc.target/i386/avx-vmovntpd-256-1.c (test for excess errors) > FAIL: gcc.target/i386/avx-vmovntps-256-1.c (test for excess errors) > FAIL: libmudflap.c++/pass41-frag.cxx execution test > FAIL: libmudflap.c++/pass41-frag.cxx (-static) execution test > FAIL: libmudflap.c++/pass41-frag.cxx (-O2) execution test > FAIL: libmudflap.c++/pass41-frag.cxx (-O3) execution test > > All of these happen without the patch too (known bugs, old binutils, and > pass41-frag never seems to work anyway). > > I'd like to ask for approval for the series. > > > Ciao, > Michael. > -- > =A0 =A0 =A0 =A0* builtins.c (fold_builtin_next_arg): Handle SSA names. > =A0 =A0 =A0 =A0* tree-ssa-copyrename.c (rename_ssa_copies): Don't iterate > =A0 =A0 =A0 =A0beyond num_ssa_names, use ssa_name() directly. > =A0 =A0 =A0 =A0* tree-ssa-ter.c (free_temp_expr_table): Likewise. > =A0 =A0 =A0 =A0* tree-ssa-coalesce.c (create_outofssa_var_map): Likewise, > =A0 =A0 =A0 =A0mark only useful SSA names. > =A0 =A0 =A0 =A0(compare_pairs): Swap cost comparison. > =A0 =A0 =A0 =A0(coalesce_ssa_name): Don't use change_partition_var. > =A0 =A0 =A0 =A0* tree-nrv.c (struct nrv_data): Add modified member. > =A0 =A0 =A0 =A0(finalize_nrv_r): Set it. > =A0 =A0 =A0 =A0(tree_nrv): Use it to update statements. > =A0 =A0 =A0 =A0(pass_nrv): Require PROP_ssa. > =A0 =A0 =A0 =A0* tree-mudflap.c (create_referenced_var): New static helpe= r. > =A0 =A0 =A0 =A0(mf_decl_cache_locals, mf_build_check_statement_for): Use = it. > =A0 =A0 =A0 =A0(pass_mudflap_2): Require PROP_ssa, run ssa update at fini= sh. > =A0 =A0 =A0 =A0* alias.c (find_base_decl): Handle SSA names. > =A0 =A0 =A0 =A0* emit-rtl (set_reg_attrs_for_parm): Make non-static. > =A0 =A0 =A0 =A0(component_ref_for_mem_expr): Don't leak SSA names into RT= L. > =A0 =A0 =A0 =A0* rtl.h (set_reg_attrs_for_parm): Declare. > =A0 =A0 =A0 =A0* tree-optimize.c (pass_cleanup_cfg_post_optimizing): Rena= me > =A0 =A0 =A0 =A0to "optimized", remove unused locals at finish. > =A0 =A0 =A0 =A0(execute_free_datastructures): Make global, call > =A0 =A0 =A0 =A0delete_tree_cfg_annotations. > =A0 =A0 =A0 =A0(execute_free_cfg_annotations): Don't call > =A0 =A0 =A0 =A0delete_tree_cfg_annotations. > > =A0 =A0 =A0 =A0* ssaexpand.h: New file. > =A0 =A0 =A0 =A0* expr.c (toplevel): Include ssaexpand.h. > =A0 =A0 =A0 =A0(expand_assignment): Handle SSA names the same as register > =A0 =A0 =A0 =A0variables. > =A0 =A0 =A0 =A0(expand_expr_real_1): Expand SSA names. > =A0 =A0 =A0 =A0* cfgexpand.c (toplevel): Include ssaexpand.h. > =A0 =A0 =A0 =A0(SA): New global variable. > =A0 =A0 =A0 =A0(gimple_cond_pred_to_tree): Fold TERed comparisons into pr= edicates. > =A0 =A0 =A0 =A0(SSAVAR): New macro. > =A0 =A0 =A0 =A0(set_rtl): New helper function. > =A0 =A0 =A0 =A0(add_stack_var): Deal with SSA names, use set_rtl. > =A0 =A0 =A0 =A0(expand_one_stack_var_at): Likewise. > =A0 =A0 =A0 =A0(expand_one_stack_var): Deal with SSA names. > =A0 =A0 =A0 =A0(stack_var_size_cmp): Use code (SSA_NAME / DECL) as tie br= eaker > =A0 =A0 =A0 =A0before unique numbers. > =A0 =A0 =A0 =A0(expand_stack_vars): Use set_rtl. > =A0 =A0 =A0 =A0(expand_one_var): Accept SSA names, add asserts for them, = feed them > =A0 =A0 =A0 =A0to above subroutines. > =A0 =A0 =A0 =A0(expand_used_vars): Expand all partitions (without default= defs), > =A0 =A0 =A0 =A0then only the local decls (ignoring those expanded already= ). > =A0 =A0 =A0 =A0(expand_gimple_cond): Remove edges when jumpif() expands an > =A0 =A0 =A0 =A0unconditional jump. > =A0 =A0 =A0 =A0(expand_gimple_basic_block): Don't clear EDGE_EXECUTABLE h= ere, > =A0 =A0 =A0 =A0or remove abnormal edges. =A0Ignore insns setting the LHS = of a TERed > =A0 =A0 =A0 =A0SSA name. > =A0 =A0 =A0 =A0(gimple_expand_cfg): Call into rewrite_out_of_ssa, initial= ize > =A0 =A0 =A0 =A0members of SA; deal with PARM_DECL partitions here; expand > =A0 =A0 =A0 =A0all PHI nodes, free tree datastructures and SA. =A0Commit = instructions > =A0 =A0 =A0 =A0on edges, clear EDGE_EXECUTABLE and remove abnormal edges = here. > =A0 =A0 =A0 =A0(pass_expand): Require and destroy PROP_ssa, verify SSA fo= rm, flow > =A0 =A0 =A0 =A0info and statements at start, collect garbage at finish. > =A0 =A0 =A0 =A0* tree-ssa-live.h (struct _var_map): Remove partition_to_v= ar member. > =A0 =A0 =A0 =A0(VAR_ANN_PARTITION) Remove. > =A0 =A0 =A0 =A0(change_partition_var): Don't declare. > =A0 =A0 =A0 =A0(partition_to_var): Always return SSA names. > =A0 =A0 =A0 =A0(var_to_partition): Only accept SSA names. > =A0 =A0 =A0 =A0(register_ssa_partition): Only check argument. > =A0 =A0 =A0 =A0* tree-ssa-live.c (init_var_map): Don't allocate partition= _to_var > =A0 =A0 =A0 =A0member. > =A0 =A0 =A0 =A0(delete_var_map): Don't free it. > =A0 =A0 =A0 =A0(var_union): Only accept SSA names, simplify. > =A0 =A0 =A0 =A0(partition_view_init): Mark only useful SSA names as used. > =A0 =A0 =A0 =A0(partition_view_fini): Only deal with SSA names. > =A0 =A0 =A0 =A0(change_partition_var): Remove. > =A0 =A0 =A0 =A0(dump_var_map): Use ssa_name instead of partition_to_var m= ember. > =A0 =A0 =A0 =A0* tree-ssa.c (delete_tree_ssa): Don't remove PHI nodes on = RTL > =A0 =A0 =A0 =A0basic blocks. > =A0 =A0 =A0 =A0* tree-outof-ssa.c (toplevel): Include ssaexpand.h and exp= r.h. > =A0 =A0 =A0 =A0(struct _elim_graph): New member const_dests; nodes member= vector of > =A0 =A0 =A0 =A0ints. > =A0 =A0 =A0 =A0(set_location_for_edge): New static helper. > =A0 =A0 =A0 =A0(create_temp): Remove. > =A0 =A0 =A0 =A0(insert_partition_copy_on_edge, insert_part_to_rtx_on_edge, > =A0 =A0 =A0 =A0insert_value_copy_on_edge, insert_rtx_to_part_on_edge): New > =A0 =A0 =A0 =A0functions. > =A0 =A0 =A0 =A0(new_elim_graph): Allocate const_dests member. > =A0 =A0 =A0 =A0(clean_elim_graph): Truncate const_dests member. > =A0 =A0 =A0 =A0(delete_elim_graph): Free const_dests member. > =A0 =A0 =A0 =A0(elim_graph_size): Adapt to new type of nodes member. > =A0 =A0 =A0 =A0(elim_graph_add_node): Likewise. > =A0 =A0 =A0 =A0(eliminate_name): Likewise. > =A0 =A0 =A0 =A0(eliminate_build): Don't take basic block argument, deal o= nly with > =A0 =A0 =A0 =A0partition numbers, not variables. > =A0 =A0 =A0 =A0(get_temp_reg): New static helper. > =A0 =A0 =A0 =A0(elim_create): Use it, deal with RTL temporaries instead o= f trees. > =A0 =A0 =A0 =A0(eliminate_phi): Adjust all calls to new signature. > =A0 =A0 =A0 =A0(assign_vars, replace_use_variable, replace_def_variable):= Remove. > =A0 =A0 =A0 =A0(rewrite_trees): Only do checking. > =A0 =A0 =A0 =A0(edge_leader, stmt_list, leader_has_match, leader_match): = Remove. > =A0 =A0 =A0 =A0(same_stmt_list_p, identical_copies_p, identical_stmt_list= s_p, > =A0 =A0 =A0 =A0init_analyze_edges_for_bb, fini_analyze_edges_for_bb, > =A0 =A0 =A0 =A0contains_tree_r, MAX_STMTS_IN_LATCH, > =A0 =A0 =A0 =A0process_single_block_loop_latch, analyze_edges_for_bb, > =A0 =A0 =A0 =A0perform_edge_inserts): Remove. > =A0 =A0 =A0 =A0(expand_phi_nodes): New global function. > =A0 =A0 =A0 =A0(remove_ssa_form): Take ssaexpand parameter. =A0Don't call= removed > =A0 =A0 =A0 =A0functions, initialize new parameter, remember partitions h= aving a > =A0 =A0 =A0 =A0default def. > =A0 =A0 =A0 =A0(finish_out_of_ssa): New global function. > =A0 =A0 =A0 =A0(rewrite_out_of_ssa): Make global. =A0Adjust call to remov= e_ssa_form, > =A0 =A0 =A0 =A0don't reset in_ssa_p here. > =A0 =A0 =A0 =A0(pass_del_ssa): Remove. > =A0 =A0 =A0 =A0* tree-flow.h (struct var_ann_d): Remove out_of_ssa_tag and > =A0 =A0 =A0 =A0partition members. > =A0 =A0 =A0 =A0(execute_free_datastructures): Declare. > =A0 =A0 =A0 =A0* Makefile.in (SSAEXPAND_H): New variable. > =A0 =A0 =A0 =A0(tree-outof-ssa.o, expr.o, cfgexpand.o): Depend on SSAEXPA= ND_H. > =A0 =A0 =A0 =A0* basic-block.h (commit_one_edge_insertion): Declare. > =A0 =A0 =A0 =A0* passes.c (init_optimization_passes): Move pass_nrv and > =A0 =A0 =A0 =A0pass_mudflap2 before pass_cleanup_cfg_post_optimizing, rem= ove > =A0 =A0 =A0 =A0pass_del_ssa, pass_free_datastructures, pass_free_cfg_anno= tations. > =A0 =A0 =A0 =A0* cfgrtl.c (commit_one_edge_insertion): Make global, don't= declare. > =A0 =A0 =A0 =A0(redirect_branch_edge): Deal with super block when expandi= ng, split > =A0 =A0 =A0 =A0out jump patching itself into ... > =A0 =A0 =A0 =A0(patch_jump_insn): ... here, new static helper. > This patch caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D39922 You may need a 32bit host to see it since I didn't see it on Linux/x86-64 with -m32. --=20 H.J.