[ping*2] Fix ICE in pp_cxx_unqualified_id (PR c++/88348)
On Fri, Dec 14, 2018 at 10:59 AM Zhouyi Zhou wrote: > > Hello, > > Ping for https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00151.html > > By the way, are there any GCC open project for volunteer beginners to > > do in spare time. > > Thanks in advance for your feedback, > > Zhouyi Hello, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88348 still exists in GCC I fetched from repository today. . PING https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00151.html Thanks in advance for your feedback. Zhouyi
[ping] Fix ICE in pp_cxx_unqualified_id (PR c++/88348)
Hello, Ping for https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00151.html By the way, are there any GCC open project for volunteer beginners to do in spare time. Thanks in advance for your feedback, Zhouyi
Fix ICE in pp_cxx_unqualified_id (PR c++/88348)
cxx_pretty_printer::type_id do not treat pointer to pointer to member correctly. this patch handle pointer to pointer to member according to C++ standard 11.3.3. I don't have write access to gcc. Bootstrapped/regtested on x86_64-linux Signed-off-by: Zhouyi Zhou 2018-12-04 Zhouyi Zhou PR c++/88291 * cxx-pretty-print.c (type_id): treat pointer to pointer to member by strip out the pointee, print the type specifier of pointee, then print the rest by calling pp_cxx_ptr_operator. * g++.dg/pr88348.C: New test. --- diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index b79ff51..106e6af 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -1829,6 +1829,27 @@ cxx_pretty_printer::type_id (tree t) pp_cxx_ws_string (this, "..."); break; +case POINTER_TYPE: + { + tree pointee = strip_pointer_operator(TREE_TYPE(t)); + /* 11.3.3 */ + if (TREE_CODE(pointee) == RECORD_TYPE && + TYPE_PTRMEMFUNC_P(pointee)) { + tree pfm = TYPE_PTRMEMFUNC_FN_TYPE (pointee); + pp_cxx_type_specifier_seq (this, TREE_TYPE (TREE_TYPE (pfm))); + pp_cxx_whitespace (this); + pp_cxx_ptr_operator(this, t); + break; + } else if (TREE_CODE(pointee) == OFFSET_TYPE && +TYPE_PTRMEM_P(pointee)) { + pp_cxx_type_specifier_seq (this, TYPE_PTRMEM_POINTED_TO_TYPE(pointee)); + pp_cxx_whitespace (this); + pp_cxx_ptr_operator(this, t); + break; + } + } + /* fall through */ + default: c_pretty_printer::type_id (t); break; diff --git a/gcc/testsuite/g++.dg/pr88348.C b/gcc/testsuite/g++.dg/pr88348.C new file mode 100644 index 000..5713f49 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr88348.C @@ -0,0 +1,16 @@ +// { dg-do compile { target c++11 } } + +void* operator new (__SIZE_TYPE__, void *p) { return p; } + +struct Z { + void f(int = 0) const; + int speed; +}; + +template struct helper {}; + +typedef void (Z::***QF)(int) const; +typedef int Z::***pSpeed; + +template void check1( helper * ) { } // { dg-error "is not a constant expression|type/value mismatch" } +template void check2( helper * ) { } // { dg-error "is not a constant expression|type/value mismatch" }
[PING] [PATCH] Add a comma to comment in lower_eh_constructs_2
Hi, Following patch has not been reviewed for two weeks. I think the patch is trivial, it doesn't affect other parts of GCC. https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01005.html And I don't have write permission to GCC Thanks Zhouyi On Mon, May 21, 2018 at 12:09 PM, Zhouyi Zhou wrote: > Hi > > I think the comment in lower_eh_constructs_2 need a comma. > > And I don't have write permission to GCC. > > Bootstraped on x86-64 > > Thanks, > Zhouyi > > Signed-off-by: Zhouyi Zhou > > gcc/ChangeLog: > > 2018-05-21 Zhouyi Zhou > * tree-eh.c (lower_eh_constructs_2): Add a comma to comment. > > --- > gcc/tree-eh.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c > index 30c6d9e..06fe748 100644 > --- a/gcc/tree-eh.c > +++ b/gcc/tree-eh.c > @@ -2028,7 +2028,7 @@ lower_eh_constructs_2 (struct leh_state *state, > gimple_stmt_iterator *gsi) >/* FALLTHRU */ > > case GIMPLE_ASSIGN: > - /* If the stmt can throw use a new temporary for the assignment > + /* If the stmt can throw, use a new temporary for the assignment > to a LHS. This makes sure the old value of the LHS is > available on the EH edge. Only do so for statements that > potentially fall through (no noreturn calls e.g.), otherwise > -- > 2.1.4 >
[PATCH] Add a comma to comment in lower_eh_constructs_2
Hi I think the comment in lower_eh_constructs_2 need a comma. And I don't have write permission to GCC. Bootstraped on x86-64 Thanks, Zhouyi Signed-off-by: Zhouyi Zhou <zhouzho...@gmail.com> gcc/ChangeLog: 2018-05-21 Zhouyi Zhou <zhouzho...@gmail.com> * tree-eh.c (lower_eh_constructs_2): Add a comma to comment. --- gcc/tree-eh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 30c6d9e..06fe748 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -2028,7 +2028,7 @@ lower_eh_constructs_2 (struct leh_state *state, gimple_stmt_iterator *gsi) /* FALLTHRU */ case GIMPLE_ASSIGN: - /* If the stmt can throw use a new temporary for the assignment + /* If the stmt can throw, use a new temporary for the assignment to a LHS. This makes sure the old value of the LHS is available on the EH edge. Only do so for statements that potentially fall through (no noreturn calls e.g.), otherwise -- 2.1.4
[RFC][C++] Parser: Simplifying tentative firewall
I carefully examined the code of setting up tentative firewalls to guard current context in cp/parser.c recent days, and think the code could be simplified. For example, in function cp_parser_start_tentative_firewall, 4427 cp_parser_parse_tentatively (parser); 4428 cp_parser_commit_to_topmost_tentative_parse (parser); A) cp_parser_parse_tentatively does following jobs: 1) create a new context 2) save current token 3) push deferring access B) cp_parser_commit_to_topmost_tentative_parse does following jobs: 1) mark the new context as committed 2) pop current token Clearly saving and popping current token is unneccessary. Push deferring access is also unneccessary after a carefull analysis: In function cp_parser_parse_definitely, error_occurred = cp_parser_error_occurred (parser) will always return false for committed context, so pop_to_parent_deferring_access_checks is always got called, while pushed deferring access in step (A) won't affect the result wether or not the access check should delayed to parent access level. Performance evaluation: orig) perf stat -e instructions:u ../gcc/cc1plus.orig g++.dg/template/friend28.C 59,171,628 instructions:u after) perf stat -e instructions:u ../gcc/cc1plus g++.dg/template/friend28.C 59,171,598 instructions:u bootstrapped and checked on x86-64 Signed-off-by: Zhouyi Zhou <yizhouz...@ict.ac.cn> --- gcc/cp/ChangeLog | 14 ++ gcc/cp/parser.c | 22 -- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7aca3ac..f095b1d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2016-12-29 Zhouyi Zhou <yizhouz...@ict.ac.cn> + + Simplifying tentative firewalls + * parser.c (cp_parser_start_tentative_firewall): Simplifying + tentative firewall so that it only do the necessary jobs to + guard current context. + * parser.c (cp_parser_end_tentative_firewall): Simplifying the + end of tentative firewall. + * parser.c (tentative_firewall::tentative_firewall): Simplifying + tentative firewall so that it only do the necessary jobs to + guard current context. + * parser.c (tentative_firewall::~tentative_firewall): Simplifying + the end of tentative firewall. + 2016-12-24 Jakub Jelinek <ja...@redhat.com> PR middle-end/78901 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e2a0a49..ebcc802 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -4424,8 +4424,8 @@ cp_parser_start_tentative_firewall (cp_parser *parser) if (!cp_parser_uncommitted_to_tentative_parse_p (parser)) return 0; - cp_parser_parse_tentatively (parser); - cp_parser_commit_to_topmost_tentative_parse (parser); + parser->context = cp_parser_context_new (parser->context); + parser->context->status = CP_PARSER_STATUS_KIND_COMMITTED; return cp_lexer_token_position (parser->lexer, false); } @@ -4436,11 +4436,16 @@ static void cp_parser_end_tentative_firewall (cp_parser *parser, cp_token_position start, tree expr) { + cp_parser_context *context; + if (!start) return; /* Finish the firewall level. */ - cp_parser_parse_definitely (parser); + context = parser->context; + parser->context = context->next; + context->next = cp_parser_context_free_list; + cp_parser_context_free_list = context; /* And remember the result of the parse for when we try again. */ cp_token *token = cp_lexer_token_at (parser->lexer, start); token->type = CPP_PREPARSED_EXPR; @@ -4465,8 +4470,8 @@ struct tentative_firewall firewall and then an inner tentative parse. */ if ((set = cp_parser_uncommitted_to_tentative_parse_p (parser))) { - cp_parser_parse_tentatively (parser); - cp_parser_commit_to_topmost_tentative_parse (parser); + parser->context = cp_parser_context_new (parser->context); + parser->context->status = CP_PARSER_STATUS_KIND_COMMITTED; cp_parser_parse_tentatively (parser); } } @@ -4477,9 +4482,14 @@ struct tentative_firewall { /* Finish the inner tentative parse and the firewall, propagating any uncommitted error state to the outer tentative parse. */ + cp_parser_context *context; bool err = cp_parser_error_occurred (parser); cp_parser_parse_definitely (parser); - cp_parser_parse_definitely (parser); + /* Finish the firewall level. */ + context = parser->context; + parser->context = context->next; + context->next = cp_parser_context_free_list; + cp_parser_context_free_list = context; if (err) cp_parser_simulate_error (parser); } -- 1.9.1
Re: Re: [PATCH IRA] save a call to init_reload
Thanks Vladimir for reviewing my patch. > Thank you for the patch. The toplev.c part of the patch is ok for stage 1. > > As for reload1.c part, I don't see what you actually changed. > Please forgive my innocence, I have mistakenly thought the form-feed character "^L" in line 415 is a type error. Cheers Zhouyi
[PATCH IRA] save a call to init_reload
save a function call to init_reload when using lra, also remove the a type error in reload1.c because init_reload is called only once when compile process, the performance reduction may not be significant when compiling multi function source files. performance evaluation using valgrind (gcc.c-torture/compile/simd-6.c): valgrind --tool=lackey --log-file=tmp1 ../gcc/cc1.orig -O2 simd-6.c 2>/dev/null valgrind --tool=lackey --log-file=tmp ../gcc/cc1 -O2 simd-6.c 2>/dev/null orig: ==1139== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==1139== Command: ../gcc/cc1.orig -O2 simd-6.c ==1139== Parent PID: 14895 ==1139== ==1139== ==1139== Counted 1 call to main() ==1139== ==1139== Jccs: ==1139== total: 2,309,094 ==1139== taken: 960,254 (42%) ==1139== ==1139== Executed: ==1139== SBs entered: 2,671,880 ==1139== SBs completed: 1,662,561 ==1139== guest instrs: 15,729,468 ==1139== IRStmts: 93,198,764 after: ==1142== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==1142== Command: ../gcc/cc1 -O2 simd-6.c ==1142== Parent PID: 14895 ==1142== ==1142== ==1142== Counted 1 call to main() ==1142== ==1142== Jccs: ==1142== total: 2,306,506 ==1142== taken: 959,362 (42%) ==1142== ==1142== Executed: ==1142== SBs entered: 2,669,050 ==1142== SBs completed: 1,660,884 ==1142== guest instrs: 15,714,064 ==1142== IRStmts: 93,106,144 bootstrapped and checked on x86-64 Signed-off-by: Zhouyi Zhou <yizhouz...@ict.ac.cn> --- gcc/ChangeLog | 9 + gcc/reload1.c | 2 +- gcc/toplev.c | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8d9a94d..9f78348 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-04-11 Zhouyi Zhou <yizhouz...@ict.ac.cn> + + * toplev.c (backend_init_target): save a function call to init_reload + when using lra. + +2016-04-11 Zhouyi Zhou <yizhouz...@ict.ac.cn> + + * reload1.c : fix a type error in reload1.c. + 2016-04-09 Tom de Vries <t...@codesourcery.com> PR tree-optimization/68953 diff --git a/gcc/reload1.c b/gcc/reload1.c index c2800f8..8310dc5 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -412,7 +412,7 @@ static bool gen_reload_chain_without_interm_reg_p (int, int); static int reloads_conflict (int, int); static rtx_insn *gen_reload (rtx, rtx, int, enum reload_type); static rtx_insn *emit_insn_if_valid_for_reload (rtx); - + /* Initialize the reload pass. This is called at the beginning of compilation and may be called again if the target is reinitialized. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index c480bfc..14ac9c5 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1620,7 +1620,8 @@ backend_init_target (void) init_alias_target (); /* Depends on HARD_FRAME_POINTER_REGNUM. */ - init_reload (); + if (!ira_use_lra_p) +init_reload (); /* Depends on the enabled attribute. */ recog_init (); -- 1.9.1
Re: Re: [PATCH IRA] save a bitmap check
Thanks Vladimir and Jeff for reviewing and doing performance tests for me. I am focusing on IRA in my off hours for years because it is in the middle of compiler backend which doesn't depend on specific programming language nor application binary interface, and is very delicate. Hope I can be of more beneficial :-) Cheers Zhouyi -Original Messages- From: Vladimir Makarov vmaka...@redhat.com Sent Time: Thursday, June 25, 2015 To: Zhouyi Zhou yizhouz...@ict.ac.cn, gcc-patches@gcc.gnu.org Cc: Subject: Re: [PATCH IRA] save a bitmap check On 06/25/2015 11:08 AM, Vladimir Makarov wrote: On 06/24/2015 05:54 AM, Zhouyi Zhou wrote: In function assign_hard_reg, checking the bit of conflict_a in consideration_allocno_bitmap is unneccesary, because when retry_p is false, conflicting objects are always inside of the same loop_node (this is ensured in function process_bb_node_lives which marks the living objects to death near the end of that function). Your email reminded me that I need to commit another your patch which I promised to commit when GCC is on stage1. I am going to do it today. Sorry, it looks like Jeff already did it in April. So your previous patch is already in the trunk.
[PATCH IRA] save a bitmap check
In function assign_hard_reg, checking the bit of conflict_a in consideration_allocno_bitmap is unneccesary, because when retry_p is false, conflicting objects are always inside of the same loop_node (this is ensured in function process_bb_node_lives which marks the living objects to death near the end of that function). Bootstrap and regtest scheduled on x86_64 GNU/Linux Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ChangeLog | 4 gcc/ira-color.c | 6 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1f82b2..07605ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-06-24 Zhouyi Zhou yizhouz...@ict.ac.cn + + * ira-color.c (assign_hard_reg): save a bitmap check + 2015-06-24 Andreas Krebbel kreb...@linux.vnet.ibm.com PR rtl-optimization/66306 diff --git a/gcc/ira-color.c b/gcc/ira-color.c index 6c53507..d7776d6 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -1733,14 +1733,12 @@ assign_hard_reg (ira_allocno_t a, bool retry_p) /* Reload can give another class so we need to check all allocnos. */ if (!retry_p - (!bitmap_bit_p (consideration_allocno_bitmap, -ALLOCNO_NUM (conflict_a)) - || ((!ALLOCNO_ASSIGNED_P (conflict_a) + ((!ALLOCNO_ASSIGNED_P (conflict_a) || ALLOCNO_HARD_REGNO (conflict_a) 0) !(hard_reg_set_intersect_p (profitable_hard_regs, ALLOCNO_COLOR_DATA - (conflict_a)-profitable_hard_regs) + (conflict_a)-profitable_hard_regs continue; conflict_aclass = ALLOCNO_CLASS (conflict_a); ira_assert (ira_reg_classes_intersect_p -- 1.9.1
Ping: [PATCH V2] IRA: Speed up setup_left_conflict_sizes_p
Hi Vladimir, I am studying IRA in my offer hours because it is marvellous and very educative. Did you get a chance to look at the below patch. The elements of allocno_hard_regs_subnode_index are setup in function setup_allocno_hard_regs_subnode_index where elements representing subnodes of a node are nonegative. I think we can avoid involving the parent itself into the loop below because when the loop invariant i == 0, allocno_hard_regs_nodes[i + node_preorder_num] will be current node, I guess we are not interested in computing left conflict subnodes size of current node's parent in current function context. Thanks and Regards Zhouyi -- Forwarded message -- From: Zhouyi Zhou zhouzho...@gmail.com Date: Thu, Mar 12, 2015 at 9:34 AM Subject: [PATCH V2] IRA: Speed up setup_left_conflict_sizes_p To: gcc-patches@gcc.gnu.org, richard.guent...@gmail.com Cc: Zhouyi Zhou zhouzho...@gmail.com, Zhouyi Zhou yizhouz...@ict.ac.cn From: Zhouyi Zhou zhouzho...@gmail.com In function setup_left_conflict_sizes_p, left conflict subnodes sizes are computed in a bottom-to-up fashion through the regnodes foreast. Speed up the process from prevent node itself to involve in this computation. I have no write access to GCC SVN repository, if it OK, can you commit for me? (Thanks Richard for reviewing) Bootstrap and regtest scheduled on x86_64 GNU/Linux Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ChangeLog |5 + gcc/ira-color.c |8 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53f582b..a495dfc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-03-12 Zhouyi Zhou yizhouz...@ict.ac.cn + + * ira-color.c (setup_left_conflict_sizes_p): Prevent node itself + from computing left conflict subnodes size. + 2015-03-10 Jan Hubicka hubi...@ucw.cz * cgraph.c (cgraph_node::release_body): Free function_in_decl_state. diff --git a/gcc/ira-color.c b/gcc/ira-color.c index ff1fe8a..d2d5102 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -938,7 +938,7 @@ setup_left_conflict_sizes_p (ira_allocno_t a) subnodes[i].left_conflict_subnodes_size = 0; } start = node_preorder_num * allocno_hard_regs_nodes_num; - for (i = data-hard_regs_subnodes_num - 1; i = 0; i--) + for (i = data-hard_regs_subnodes_num - 1; i 0; i--) { int size, parent_i; allocno_hard_regs_node_t parent; @@ -948,12 +948,10 @@ setup_left_conflict_sizes_p (ira_allocno_t a) - subnodes[i].left_conflict_subnodes_size, subnodes[i].left_conflict_size)); parent = allocno_hard_regs_nodes[i + node_preorder_num]-parent; - if (parent == NULL) - continue; + gcc_checking_assert(parent); parent_i = allocno_hard_regs_subnode_index[start + parent-preorder_num]; - if (parent_i 0) - continue; + gcc_checking_assert(parent_i = 0); subnodes[parent_i].left_conflict_subnodes_size += size; } left_conflict_subnodes_size = subnodes[0].left_conflict_subnodes_size; -- 1.7.10.4
[PATCH V2] IRA: Speed up setup_left_conflict_sizes_p
From: Zhouyi Zhou zhouzho...@gmail.com In function setup_left_conflict_sizes_p, left conflict subnodes sizes are computed in a bottom-to-up fashion through the regnodes foreast. Speed up the process from prevent node itself to involve in this computation. I have no write access to GCC SVN repository, if it OK, can you commit for me? (Thanks Richard for reviewing) Bootstrap and regtest scheduled on x86_64 GNU/Linux Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ChangeLog |5 + gcc/ira-color.c |8 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53f582b..a495dfc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-03-12 Zhouyi Zhou yizhouz...@ict.ac.cn + + * ira-color.c (setup_left_conflict_sizes_p): Prevent node itself + from computing left conflict subnodes size. + 2015-03-10 Jan Hubicka hubi...@ucw.cz * cgraph.c (cgraph_node::release_body): Free function_in_decl_state. diff --git a/gcc/ira-color.c b/gcc/ira-color.c index ff1fe8a..d2d5102 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -938,7 +938,7 @@ setup_left_conflict_sizes_p (ira_allocno_t a) subnodes[i].left_conflict_subnodes_size = 0; } start = node_preorder_num * allocno_hard_regs_nodes_num; - for (i = data-hard_regs_subnodes_num - 1; i = 0; i--) + for (i = data-hard_regs_subnodes_num - 1; i 0; i--) { int size, parent_i; allocno_hard_regs_node_t parent; @@ -948,12 +948,10 @@ setup_left_conflict_sizes_p (ira_allocno_t a) - subnodes[i].left_conflict_subnodes_size, subnodes[i].left_conflict_size)); parent = allocno_hard_regs_nodes[i + node_preorder_num]-parent; - if (parent == NULL) - continue; + gcc_checking_assert(parent); parent_i = allocno_hard_regs_subnode_index[start + parent-preorder_num]; - if (parent_i 0) - continue; + gcc_checking_assert(parent_i = 0); subnodes[parent_i].left_conflict_subnodes_size += size; } left_conflict_subnodes_size = subnodes[0].left_conflict_subnodes_size; -- 1.7.10.4
[PATCH ] IRA: Speed up setup_left_conflict_sizes_p
From: Zhouyi Zhou yizhouz...@ict.ac.cn In function setup_left_conflict_sizes_p, left conflict subnodes sizes are computed in a down-to-up fashion through the regnodes foreast. Speed up the process from prevent node itself to involve in this computation. Bootstrap and regtest scheduled on x86_64 GNU/Linux Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ChangeLog |5 + gcc/ira-color.c |8 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b77fb5e..7688eda 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-03-11 Zhouyi Zhou yizhouz...@ict.ac.cn + + * ira-color.c (setup_left_conflict_sizes_p): Prevent node itself + from computing left conflict subnodes size. + 2015-03-10 Jakub Jelinek ja...@redhat.com PR target/65368 diff --git a/gcc/ira-color.c b/gcc/ira-color.c index ff1fe8a..3e5c33a 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -938,7 +938,7 @@ setup_left_conflict_sizes_p (ira_allocno_t a) subnodes[i].left_conflict_subnodes_size = 0; } start = node_preorder_num * allocno_hard_regs_nodes_num; - for (i = data-hard_regs_subnodes_num - 1; i = 0; i--) + for (i = data-hard_regs_subnodes_num - 1; i 0; i--) { int size, parent_i; allocno_hard_regs_node_t parent; @@ -948,12 +948,10 @@ setup_left_conflict_sizes_p (ira_allocno_t a) - subnodes[i].left_conflict_subnodes_size, subnodes[i].left_conflict_size)); parent = allocno_hard_regs_nodes[i + node_preorder_num]-parent; - if (parent == NULL) - continue; + gcc_assert (parent); parent_i = allocno_hard_regs_subnode_index[start + parent-preorder_num]; - if (parent_i 0) - continue; + gcc_assert (parent_i = 0); subnodes[parent_i].left_conflict_subnodes_size += size; } left_conflict_subnodes_size = subnodes[0].left_conflict_subnodes_size; -- 1.7.10.4
[PATCH] gcc/ira-color.c: save a init statement
In function setup_left_conflict_sizes_p, init assignment conflict_size = 0 could be eliminated for the tidiness. I have no write access to gcc repository and I can't provide a testcase because the improvement has effective compiler no output. Bootstraped and regtested in x86_64 Linux Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ChangeLog |3 +++ gcc/ira-color.c |3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bd74326..577b57e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,6 @@ +2015-02-09 Zhouyi Zhou yizhouz...@ict.ac.cn + * ira-color.c (setup_left_conflict_sizes_p): save a init statement. + 2015-02-08 Andrew Pinski apin...@cavium.com * config/aarch64/aarch64.c (gty_dummy): Delete. diff --git a/gcc/ira-color.c b/gcc/ira-color.c index d04be29..5591637 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -858,7 +858,6 @@ setup_left_conflict_sizes_p (ira_allocno_t a) HARD_REG_SET node_set; nobj = ALLOCNO_NUM_OBJECTS (a); - conflict_size = 0; data = ALLOCNO_COLOR_DATA (a); subnodes = allocno_hard_regs_subnodes + data-hard_regs_subnodes_start; COPY_HARD_REG_SET (profitable_hard_regs, data-profitable_hard_regs); @@ -959,7 +958,7 @@ setup_left_conflict_sizes_p (ira_allocno_t a) } left_conflict_subnodes_size = subnodes[0].left_conflict_subnodes_size; conflict_size -+= (left_conflict_subnodes_size += (left_conflict_subnodes_size + MIN (subnodes[0].max_node_impact - left_conflict_subnodes_size, subnodes[0].left_conflict_size)); conflict_size += ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]; -- 1.7.10.4
Re: Re: [PATCH 1/1] gcc/ira-build.c: save a conflict obj compare in ira_flattening
Thanks Jeff for reviewing, I forget to mention that I do not have write access to gcc. Can you install for me ? Cheers Zhouyi -Original Messages- From: Jeff Law l...@redhat.com Sent Time: Tuesday, December 23, 2014 To: Zhouyi Zhou zhouzho...@gmail.com, gcc-patches@gcc.gnu.org Cc: Zhouyi Zhou yizhouz...@ict.ac.cn Subject: Re: [PATCH 1/1] gcc/ira-build.c: save a conflict obj compare in ira_flattening On 12/21/14 23:34, Zhouyi Zhou wrote: In function ira_flattening, conflict relationship will be rebuilt in case of any new pseudo register has been created during ira_emit. By adding the current object to OBJECTS_LIVE after traversing OBJECTS_LIVE, a conflict obj compare can be saved. Bootstraped and regtested in x86_64 Linux Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ChangeLog |5 + gcc/ira-build.c |2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5d16f9..c0ce758 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-12-22 Zhouyi Zhou yizhouz...@ict.ac.cn + + * ira-build.c (ira_flattening): Add the current + object to OBJECTS_LIVE after traversing OBJECTS_LIVE. This is OK. Please install on the trunk. Thanks, Jeff
[PATCH 1/1] gcc/ira-build.c: save a conflict obj compare in ira_flattening
In function ira_flattening, conflict relationship will be rebuilt in case of any new pseudo register has been created during ira_emit. By adding the current object to OBJECTS_LIVE after traversing OBJECTS_LIVE, a conflict obj compare can be saved. Bootstraped and regtested in x86_64 Linux Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ChangeLog |5 + gcc/ira-build.c |2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5d16f9..c0ce758 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-12-22 Zhouyi Zhou yizhouz...@ict.ac.cn + + * ira-build.c (ira_flattening): Add the current + object to OBJECTS_LIVE after traversing OBJECTS_LIVE. + 2014-12-17 Oleg Endo olege...@gcc.gnu.org PR target/55212 diff --git a/gcc/ira-build.c b/gcc/ira-build.c index af82b71..66318096 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -3252,7 +3252,6 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) continue; aclass = ALLOCNO_CLASS (a); - sparseset_set_bit (objects_live, OBJECT_CONFLICT_ID (obj)); EXECUTE_IF_SET_IN_SPARSESET (objects_live, n) { ira_object_t live_obj = ira_object_id_map[n]; @@ -3264,6 +3263,7 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) live_a != a) ira_add_conflict (obj, live_obj); } + sparseset_set_bit (objects_live, OBJECT_CONFLICT_ID (obj)); } for (r = ira_finish_point_ranges[i]; r != NULL; r = r-finish_next) -- 1.7.10.4
[PATCH] gcc/ira-conflicts.c: avoid conflict obj compare with itself
From: Zhouyi Zhou yizhouz...@ict.ac.cn In function build_conflict_bit_table, id is set in objects_live before traversing that sparseset, so the obj is unnessary compared with itself during the traversing. The comparing of obj with itself can be avoided by means of moving sparseset_set_bit (objects_live, id) after the traversing. I have no write access to gcc repository and I can't provide a testcase because the improvement has effective compile no output. Bootstraped and regtested in x86_64 Linux Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ChangeLog |4 gcc/ira-conflicts.c |2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d385e33..3f4b14e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2014-11-17 Zhouyi Zhou yizhouz...@ict.ac.cn + + * ira-conflicts.c (build_conflict_bit_table): avoid obj self comparing. + 2014-11-16 Jan Hubicka hubi...@ucw.cz * ipa-polymorphic-call.c diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c index 7aaf0cb..cccdb6b 100644 --- a/gcc/ira-conflicts.c +++ b/gcc/ira-conflicts.c @@ -177,7 +177,6 @@ build_conflict_bit_table (void) gcc_assert (id ira_objects_num); aclass = ALLOCNO_CLASS (allocno); - sparseset_set_bit (objects_live, id); EXECUTE_IF_SET_IN_SPARSESET (objects_live, j) { ira_object_t live_obj = ira_object_id_map[j]; @@ -191,6 +190,7 @@ build_conflict_bit_table (void) record_object_conflict (obj, live_obj); } } + sparseset_set_bit (objects_live, id); } for (r = ira_finish_point_ranges[i]; r != NULL; r = r-finish_next) -- 1.7.10.4
[PATCH 1/1][ira-costs] grammar fix of comments
Fix grammar error for comments above process_bb_node_for_hard_reg_moves Signed-off-by: Zhouyi Zhou yizhouz...@ict.ac.cn --- gcc/ira-costs.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 648806b..fbfb070 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -1855,7 +1855,7 @@ find_costs_and_classes (FILE *dump_file) /* Process moves involving hard regs to modify allocno hard register costs. We can do this only after determining allocno class. If a - hard register forms a register class, than moves with the hard + hard register forms a register class, then moves with the hard register are already taken into account in class costs for the allocno. */ static void -- 1.7.1
[PATCH] TREE-SSA remove redundant condition checks in get_default_value
In function get_default_value of tree-ssa-ccp.c, 261 else if (is_gimple_assign (stmt) 262/* Value-returning GIMPLE_CALL statements assign to 263 a variable, and are treated similarly to GIMPLE_ASSIGN. */ 264|| (is_gimple_call (stmt) 265 gimple_call_lhs (stmt) != NULL_TREE) 266|| gimple_code (stmt) == GIMPLE_PHI) 267 { 268 tree cst; 269 if (gimple_assign_single_p (stmt) 270DECL_P (gimple_assign_rhs1 (stmt)) 271(cst = get_symbol_constant_value (gimple_assign_rhs1 (stmt 272 { 273 val.lattice_val = CONSTANT; 274 val.value = cst; 275 } 276 else 277 /* Any other variable defined by an assignment or a PHI node 278is considered UNDEFINED. */ 279 val.lattice_val = UNDEFINED; if the stmt is a gimple call node or a gimple phi node, it will never satisfy the condition gimple_assign_single_p (stmt). so there exists redundant condition checks. The patch attached try to remove this. Bootstrap passed. Regression tested on x86_64-unknown-linux-gnu (pc). ChangeLog: 2013-08-13 Zhouyi Zhou yizhouz...@ict.ac.cn * tree-ssa-ccp.c (get_default_value): remove redundant condition checks -- Zhouyi Zhou yizhouz...@ict.ac.cn diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 6472f48..7fbb687 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -258,12 +258,7 @@ get_default_value (tree var) val.mask = double_int_minus_one; } } - else if (is_gimple_assign (stmt) - /* Value-returning GIMPLE_CALL statements assign to - a variable, and are treated similarly to GIMPLE_ASSIGN. */ - || (is_gimple_call (stmt) - gimple_call_lhs (stmt) != NULL_TREE) - || gimple_code (stmt) == GIMPLE_PHI) + else if (is_gimple_assign (stmt)) { tree cst; if (gimple_assign_single_p (stmt) @@ -274,10 +269,18 @@ get_default_value (tree var) val.value = cst; } else - /* Any other variable defined by an assignment or a PHI node + /* Any other variable defined by an assignment is considered UNDEFINED. */ val.lattice_val = UNDEFINED; } + else if ((is_gimple_call (stmt) + gimple_call_lhs (stmt) != NULL_TREE) + || gimple_code (stmt) == GIMPLE_PHI) +{ + /*Variable defined by a call or a PHI node + is considered UNDEFINED. */ + val.lattice_val = UNDEFINED; +} else { /* Otherwise, VAR will never take on a constant value. */
Re: [PATCH v3]IPA: fixing inline fail report caused by overwritable functions.
Thanks Richard, nice adding, regression passed on my x86_64 GNU/Linux On Wed, Apr 10, 2013 at 5:22 PM, Richard Biener richard.guent...@gmail.com wrote: On Tue, Apr 9, 2013 at 5:10 PM, Zhouyi Zhou zhouzho...@gmail.com wrote: Hi Richard, I do not have write access to GCC SVN repository, can you commit it for me? Thanks alot Committed with adding { dg-require-weak } to the testcase. Richard. Cheers Zhouyi On Tue, Apr 9, 2013 at 5:04 PM, Richard Biener richard.guent...@gmail.com wrote: On Tue, Apr 9, 2013 at 5:40 AM, Zhouyi Zhou zhouzho...@gmail.com wrote: On Mon, Apr 8, 2013 at 5:48 PM, Richard Biener richard.guent...@gmail.com wrote: Can you trigger this message to show up with -Winline before/after the patch? Can you please add a testcase then? Thanks Richard for reviewing, from my point of view about gcc and my invoking of gcc, -Winline only works on callees that be declared inline, but if the callee is declared inline, it will be AVAIL_AVAILABLE in function can_inline_edge_p, thus out of the range of my patch. Ah, indeed ... So I only add a testcase for fixing the tree dump, are there any thing more I can do? No. Patch is ok. Thanks, Richard. Regtested/bootstrapped on x86_64-linux ChangeLog: 2013-04-08 Zhouyi Zhou yizhouz...@ict.ac.cn * cif-code.def (OVERWRITABLE): correct the comment for overwritable function * ipa-inline.c (can_inline_edge_p): let dump mechanism report the inline fail caused by overwritable functions. * gcc.dg/tree-ssa/inline-11.c: New test Index: gcc/cif-code.def === --- gcc/cif-code.def(revision 197549) +++ gcc/cif-code.def(working copy) @@ -48,7 +48,7 @@ DEFCIFCODE(REDEFINED_EXTERN_INLINE, /* Function is not inlinable. */ DEFCIFCODE(FUNCTION_NOT_INLINABLE, N_(function not inlinable)) -/* Function is not overwritable. */ +/* Function is overwritable. */ DEFCIFCODE(OVERWRITABLE, N_(function body can be overwritten at link time)) /* Function is not an inlining candidate. */ Index: gcc/testsuite/gcc.dg/tree-ssa/inline-11.c === --- gcc/testsuite/gcc.dg/tree-ssa/inline-11.c (revision 0) +++ gcc/testsuite/gcc.dg/tree-ssa/inline-11.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options -O2 -fdump-tree-einline } */ +int w; +int bar (void) __attribute__ ((weak)); +int bar (){ + w++; +} +void foo() +{ + bar(); +} +/* { dg-final { scan-tree-dump-times function body can be overwritten at link time 1 einline } } */ +/* { dg-final { cleanup-tree-dump einline } } */ Index: gcc/ipa-inline.c === --- gcc/ipa-inline.c(revision 197549) +++ gcc/ipa-inline.c(working copy) @@ -266,7 +266,7 @@ can_inline_edge_p (struct cgraph_edge *e else if (avail = AVAIL_OVERWRITABLE) { e-inline_failed = CIF_OVERWRITABLE; - return false; + inlinable = false; } else if (e-call_stmt_cannot_inline_p) {
Re: [PATCH v3]IPA: fixing inline fail report caused by overwritable functions.
Hi Richard, I do not have write access to GCC SVN repository, can you commit it for me? Thanks alot Cheers On Tue, Apr 9, 2013 at 5:04 PM, Richard Biener richard.guent...@gmail.com wrote: On Tue, Apr 9, 2013 at 5:40 AM, Zhouyi Zhou zhouzho...@gmail.com wrote: On Mon, Apr 8, 2013 at 5:48 PM, Richard Biener richard.guent...@gmail.com wrote: Can you trigger this message to show up with -Winline before/after the patch? Can you please add a testcase then? Thanks Richard for reviewing, from my point of view about gcc and my invoking of gcc, -Winline only works on callees that be declared inline, but if the callee is declared inline, it will be AVAIL_AVAILABLE in function can_inline_edge_p, thus out of the range of my patch. Ah, indeed ... So I only add a testcase for fixing the tree dump, are there any thing more I can do? No. Patch is ok. Thanks, Richard. Regtested/bootstrapped on x86_64-linux ChangeLog: 2013-04-08 Zhouyi Zhou yizhouz...@ict.ac.cn * cif-code.def (OVERWRITABLE): correct the comment for overwritable function * ipa-inline.c (can_inline_edge_p): let dump mechanism report the inline fail caused by overwritable functions. * gcc.dg/tree-ssa/inline-11.c: New test Index: gcc/cif-code.def === --- gcc/cif-code.def(revision 197549) +++ gcc/cif-code.def(working copy) @@ -48,7 +48,7 @@ DEFCIFCODE(REDEFINED_EXTERN_INLINE, /* Function is not inlinable. */ DEFCIFCODE(FUNCTION_NOT_INLINABLE, N_(function not inlinable)) -/* Function is not overwritable. */ +/* Function is overwritable. */ DEFCIFCODE(OVERWRITABLE, N_(function body can be overwritten at link time)) /* Function is not an inlining candidate. */ Index: gcc/testsuite/gcc.dg/tree-ssa/inline-11.c === --- gcc/testsuite/gcc.dg/tree-ssa/inline-11.c (revision 0) +++ gcc/testsuite/gcc.dg/tree-ssa/inline-11.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options -O2 -fdump-tree-einline } */ +int w; +int bar (void) __attribute__ ((weak)); +int bar (){ + w++; +} +void foo() +{ + bar(); +} +/* { dg-final { scan-tree-dump-times function body can be overwritten at link time 1 einline } } */ +/* { dg-final { cleanup-tree-dump einline } } */ Index: gcc/ipa-inline.c === --- gcc/ipa-inline.c(revision 197549) +++ gcc/ipa-inline.c(working copy) @@ -266,7 +266,7 @@ can_inline_edge_p (struct cgraph_edge *e else if (avail = AVAIL_OVERWRITABLE) { e-inline_failed = CIF_OVERWRITABLE; - return false; + inlinable = false; } else if (e-call_stmt_cannot_inline_p) {
Re: [PATCH v3]IPA: fixing inline fail report caused by overwritable functions.
On Mon, Apr 8, 2013 at 5:48 PM, Richard Biener richard.guent...@gmail.com wrote: Can you trigger this message to show up with -Winline before/after the patch? Can you please add a testcase then? Thanks Richard for reviewing, from my point of view about gcc and my invoking of gcc, -Winline only works on callees that be declared inline, but if the callee is declared inline, it will be AVAIL_AVAILABLE in function can_inline_edge_p, thus out of the range of my patch. So I only add a testcase for fixing the tree dump, are there any thing more I can do? Regtested/bootstrapped on x86_64-linux ChangeLog: 2013-04-08 Zhouyi Zhou yizhouz...@ict.ac.cn * cif-code.def (OVERWRITABLE): correct the comment for overwritable function * ipa-inline.c (can_inline_edge_p): let dump mechanism report the inline fail caused by overwritable functions. * gcc.dg/tree-ssa/inline-11.c: New test Index: gcc/cif-code.def === --- gcc/cif-code.def(revision 197549) +++ gcc/cif-code.def(working copy) @@ -48,7 +48,7 @@ DEFCIFCODE(REDEFINED_EXTERN_INLINE, /* Function is not inlinable. */ DEFCIFCODE(FUNCTION_NOT_INLINABLE, N_(function not inlinable)) -/* Function is not overwritable. */ +/* Function is overwritable. */ DEFCIFCODE(OVERWRITABLE, N_(function body can be overwritten at link time)) /* Function is not an inlining candidate. */ Index: gcc/testsuite/gcc.dg/tree-ssa/inline-11.c === --- gcc/testsuite/gcc.dg/tree-ssa/inline-11.c (revision 0) +++ gcc/testsuite/gcc.dg/tree-ssa/inline-11.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options -O2 -fdump-tree-einline } */ +int w; +int bar (void) __attribute__ ((weak)); +int bar (){ + w++; +} +void foo() +{ + bar(); +} +/* { dg-final { scan-tree-dump-times function body can be overwritten at link time 1 einline } } */ +/* { dg-final { cleanup-tree-dump einline } } */ Index: gcc/ipa-inline.c === --- gcc/ipa-inline.c(revision 197549) +++ gcc/ipa-inline.c(working copy) @@ -266,7 +266,7 @@ can_inline_edge_p (struct cgraph_edge *e else if (avail = AVAIL_OVERWRITABLE) { e-inline_failed = CIF_OVERWRITABLE; - return false; + inlinable = false; } else if (e-call_stmt_cannot_inline_p) {
[PATCH v3]IPA: fixing inline fail report caused by overwritable functions.
When inline failed because of callee is overwritable, gcc will not report it in dump file (triggered by -fdump-tree-einline) as other not inlinable cases do. This patch correct this. Regtested/bootstrapped on x86_64-linux. ChangeLog: 2013-04-08 Zhouyi Zhou yizhouz...@ict.ac.cn * cif-code.def (OVERWRITABLE): correct the comment for overwritable function * ipa-inline.c (can_inline_edge_p): let dump mechanism report the inline fail caused by overwritable functions. Index: gcc/ipa-inline.c === --- gcc/ipa-inline.c(revision 197549) +++ gcc/ipa-inline.c(working copy) @@ -266,7 +266,7 @@ can_inline_edge_p (struct cgraph_edge *e else if (avail = AVAIL_OVERWRITABLE) { e-inline_failed = CIF_OVERWRITABLE; - return false; + inlinable = false; } else if (e-call_stmt_cannot_inline_p) { Index: gcc/cif-code.def === --- gcc/cif-code.def(revision 197549) +++ gcc/cif-code.def(working copy) @@ -48,7 +48,7 @@ DEFCIFCODE(REDEFINED_EXTERN_INLINE, /* Function is not inlinable. */ DEFCIFCODE(FUNCTION_NOT_INLINABLE, N_(function not inlinable)) -/* Function is not overwritable. */ +/* Function is overwritable. */ DEFCIFCODE(OVERWRITABLE, N_(function body can be overwritten at link time)) /* Function is not an inlining candidate. */