[Bug rtl-optimization/39165] New: redundant simplify_cond in genattrtab.c
in function simplify_cond (genattrtab.c) 1743 if (len == 0) 1744 { 1745 if (GET_CODE (defval) == COND) 1746 ret = simplify_cond (defval, insn_code, insn_index); 1747 else 1748 ret = defval; 1749 } I think replace the code on line 1746 by ret = new_defval will save a call to simplify_cond -- Summary: redundant simplify_cond in genattrtab.c Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zhouyi04 at ios dot cn GCC build triplet: x86_32-*-FreeBSD-6.3 GCC host triplet: x86_32-*-FreeBSD-6.3 GCC target triplet: x86_32-*-FreeBSD-6.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39165
[Bug tree-optimization/36258] New: remove useless edge split in copy_loop_headers
The function copy_loop_headers after duplicate the region for a loop, 237 /* Ensure that the latch and the preheader is simple (we know that they 238 are not now, since there was the loop exit condition. */ 239 split_edge (loop_preheader_edge (loop)); 240 split_edge (loop_latch_edge (loop)); 241 } In fact, the statements in line 239 and 240 are useless because there will be no code motion optimizing (for example loop invariant movement) related to that splitting in this pass, and the edges created by above statements are removed by cfg cleanup in execute_todo that follows. I have comment out the statements of line 239 and 240, and bootstraped and tested on Linux i686 i686 i686 GNU/Linux. I also compared the output asm files on about 2000 C files under gcc.c-torture, there is no difference when compiled using the compilers before commenting out above statements and after commenting out the statements. Thanks alot Zhouyi Zhou -- Summary: remove useless edge split in copy_loop_headers Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zhouyi04 at ios dot cn GCC build triplet: Linux i686 i686 i686 GNU/Linux GCC host triplet: Linux i686 i686 i686 GNU/Linux GCC target triplet: Linux i686 i686 i686 GNU/Linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36258
[Bug tree-optimization/35452] erasing uncessary warning for basic block frequency computation
--- Comment #1 from zhouyi04 at ios dot cn 2008-03-05 07:03 --- (In reply to comment #0) Sorry there are some problem with 1st patch because the edge e maybe removed after redirection. 24 | \ / \ 5 \ | 6 In function redirect_edge_succ_nodup, the edge from 5 to 6 will be removed because there exists one from 2 to 6. following is correct patch: --- gcc/gcc/tree-cfgcleanup.c~ Wed Mar 5 14:13:00 2008 +++ gcc/gcc/tree-cfgcleanup.c Wed Mar 5 14:13:52 2008 @@ -418,6 +418,10 @@ { bitmap_set_bit (cfgcleanup_altered_bbs, e-src-index); + + bb-frequency -= EDGE_FREQUENCY(e); + bb-count -= e-count; + if (e-flags EDGE_ABNORMAL) { /* If there is an abnormal edge, redirect it anyway, and # By the way, the frequency and count of forwarder block's succor will not be affected because he is the only child of the forwarder block. Anyone help me regression test it please -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35452
[Bug tree-optimization/35452] New: erasing uncessary warning for basic block frequency computation
When compiling program like following: int fn(int s) { int i; i = 2; if (s) i = 1; if (s) printf(%d\n, i); return 0; } #cc1 -O2 -fdump-tree-vrp-all hello.c There will be: Jumps threaded: 1 Removing basic block 3 ;; basic block 3, loop depth 0, count 0 ;; prev block 7, next block 4 ;; pred: ;; succ: 4 [100.0%] (fallthru,exec) Invalid sum of incoming frequencies 0, should be 5000 L0:; in hello.c.055t.vrp1 etc. A patch: --- gcc/gcc/tree-cfgcleanup.c~ Sat Jan 5 14:45:30 2008 +++ gcc/gcc/tree-cfgcleanup.c Tue Mar 4 11:11:49 2008 @@ -427,6 +427,9 @@ else s = redirect_edge_and_branch (e, dest); + bb-frequency -= EDGE_FREQUENCY(e); + bb-count -= e-count; + if (s == e) { /* Create arguments for the phi nodes, since the edge was not Anyone help me to regression test it, because I am not able to regression it in current juncture :-) -- Summary: erasing uncessary warning for basic block frequency computation Product: gcc Version: tree-ssa Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zhouyi04 at ios dot cn GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35452
[Bug tree-optimization/34649] redundant if expression in find_conditional_asserts
--- Comment #4 from zhouyi04 at ios dot cn 2008-01-05 09:54 --- Subject: Re: redundant if expression in find_conditional_asserts Thanks, I think I am now able to follow http://gcc.gnu.org/contribute.html#testing Sincerely yours Zhouyi Zhou -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34649
[Bug tree-optimization/34649] redundant if expression in find_conditional_asserts
--- Comment #5 from zhouyi04 at ios dot cn 2008-01-05 11:15 --- from svn update, it is fixed. make bootstrap OK -- zhouyi04 at ios dot cn changed: What|Removed |Added Status|RESOLVED|VERIFIED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34649
[Bug tree-optimization/34649] New: redundant if expression in find_conditional_asserts
/*gcc/tree-vrp.c */ 3603 static bool 3604 find_conditional_asserts (basic_block bb, tree last) 3605 { ... if (e-dest == bb) 3623 continue; ... 3652 if (e-dest != bb) 3653 need_assert |= find_assert_locations (e-dest); -- Summary: redundant if expression in find_conditional_asserts Product: gcc Version: tree-ssa Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zhouyi04 at ios dot cn GCC build triplet: i486-pc-linux-gnu GCC host triplet: i486-pc-linux-gnu GCC target triplet: i486-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34649
[Bug tree-optimization/34649] redundant if expression in find_conditional_asserts
--- Comment #2 from zhouyi04 at ios dot cn 2008-01-04 06:31 --- Subject: Re: redundant if expression in find_conditional_asserts Hey ubizjak! Please provide a regression test for me, it is the first time I have a chance to patch gcc, Thanks a lot :) Patch against gcc-4.3.0 --- gcc/tree-vrp.c~ Sun Apr 15 00:10:41 2007 +++ gcc/tree-vrp.c Fri Jan 4 09:24:24 2008 @@ -3649,8 +3649,7 @@ /* Traverse the strictly dominated sub-graph rooted at E-DEST to determine if any of the operands in the conditional predicate are used. */ - if (e-dest != bb) - need_assert |= find_assert_locations (e-dest); + need_assert |= find_assert_locations (e-dest); /* Register the necessary assertions for each operand in the conditional predicate. */ ChangeLog Entry 2008-01-04 Zhouyi Zhou [EMAIL PROTECTED] * tree-vrp.c (find_conditional_asserts): redundant if expression Sincerely yours Zhouyi Zhou -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34649
[Bug c/31886] (different from bug report c/31077 and 29241) C handling of always_inline attribute error and a solution
--- Comment #9 from zhouyi04 at ios dot cn 2007-08-06 08:40 --- (In reply to comment #8) I try to compile my giving C program using gcc-4.2.1, the problem still exists. As my solution 1 suggests: a caller function is inlinable only if all of its callee functions are inlinable. while this is not the case in original tree-optimize.c (including that in CVS), which says a caller function should be inlined if one of its function is inlinable. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31886
[Bug c/31886] New: (different from bug report c/31077 and 29241) C handling of always_inline attribute error and a solution
When compiling following code with no optimize flags given, gcc will complain: 1 __attribute__((always_inline)) unsigned int 2 alloc_null_binding1(void) 3 { 4 return 1; 5 } 6 7 static inline __attribute__((always_inline)) int ip_nat_initialized1(void) 8 { 9 10return 2; 11 } 12 13 int ip_nat_rule_find1(void) 14 { 15 int ret; 16 if (!ip_nat_initialized1()){ 17ret = alloc_null_binding1(); 18 } 19 return ret; 20 } /*** ***/ [EMAIL PROTECTED] inline]gcc -S hello.c hello.c: In function 'ip_nat_rule_find1': hello.c:3: sorry, unimplemented: inlining failed in call to 'alloc_null_binding1': function body not available hello.c:17: sorry, unimplemented: called from here /*** ***/ solutions: Solution 1: --- gcc-4.1.0/gcc/tree-optimize.c.back 2007-05-09 22:38:58.0 -0400 +++ gcc-4.1.0/gcc/tree-optimize.c 2007-05-09 22:38:31.0 -0400 @@ -389,9 +389,15 @@ break; if (e) { - timevar_push (TV_INTEGRATION); - optimize_inline_calls (fndecl); - timevar_pop (TV_INTEGRATION); + for (e = node-callees; e; e = e-next_callee) + if (e-inline_failed !warn_inline) + break; + if (!e) + { + timevar_push (TV_INTEGRATION); + optimize_inline_calls (fndecl); + timevar_pop (TV_INTEGRATION); + } } } /* We are not going to maintain the cgraph edges up to date. /*** ***/ Solution 2: --- gcc-4.1.0/gcc/cgraphunit.c.back 2007-05-09 22:41:35.0 -0400 +++ gcc-4.1.0/gcc/cgraphunit.c 2007-05-09 22:24:21.0 -0400 @@ -1206,7 +1206,7 @@ if (dump_enabled_p (TDI_tree_all)) return true; if (!cgraph_global_info_ready) -return (DECL_INLINE (decl) !flag_really_no_inline); +return ((DECL_INLINE (decl) !flag_really_no_inline)||lookup_attribute (always_inline, DECL_ATTRIBUTES (decl))); /* Look if there is any clone around. */ for (node = cgraph_node (decl); node; node = node-next_clone) if (node-global.inlined_to) --- gcc-4.1.0/gcc/tree-inline.c.back2007-05-09 22:41:18.0 -0400 +++ gcc-4.1.0/gcc/tree-inline.c 2007-05-09 22:35:12.0 -0400 @@ -1594,6 +1594,8 @@ } /* Squirrel away the result so that we don't have to check again. */ + if (lookup_attribute (always_inline, DECL_ATTRIBUTES (fn))) +inlinable = true; DECL_UNINLINABLE (fn) = !inlinable; return inlinable; /*** ***/ Sincerely yours Zhouyi Zhou -- Summary: (different from bug report c/31077 and 29241) C handling of always_inline attribute error and a solution Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zhouyi04 at ios dot cn GCC build triplet: Linux i686 GNU/Linux GCC host triplet: Linux i686 GNU/Linux GCC target triplet: Linux i686 GNU/Linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31886
[Bug c/31886] (different from bug report c/31077 and 29241) C handling of always_inline attribute error and a solution
--- Comment #4 from zhouyi04 at ios dot cn 2007-05-10 05:33 --- Dear Pinsky In addition, The problem will still exists even add a inline to line 1 of the program, unless you add a static to line 1. Sincerely yours Zhouyi Zhou -- zhouyi04 at ios dot cn changed: What|Removed |Added CC||zhouyi04 at ios dot cn http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31886
[Bug c/31077] New: C handling of always_inline attribute error and a solution
gcc will segment fault when compiling following code (copied from linux kernel) when no optimize option is given (I need to debug linux kernel without optimizing interfere my investigation): gcc -S -i hello1.i //hello1.i 1 2 struct genapic { 3 4 int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); 5 6 unsigned (*get_apic_id)(unsigned long x); 7 8 }; 9 10 static inline __attribute__((always_inline)) unsigned get_apic_id(unsigned long x) 11 { 12 return 1; 13 } 14 15 16 17 static inline int check_phys_apicid_present(int cpu_physical_apicid) 18 { 19 20 return get_apic_id(2); 21 22 } 23 24 25 struct genapic apic_es7000 = { .check_phys_apicid_present = check_phys_apicid_present,.get_apic_id = get_apic_id, }; A solution is change gcc-4.1.0's function cgraph_preserve_function_body_p: 1201 bool 1202 cgraph_preserve_function_body_p (tree decl) 1203 { 1204 struct cgraph_node *node; 1205 /* Keep the body; we're going to dump it. */ 1206 if (dump_enabled_p (TDI_tree_all)) 1207 return true; 1208 if (!cgraph_global_info_ready) 1209 return (DECL_INLINE (decl) !flag_really_no_inline); 1210 /* Look if there is any clone around. */ 1211 for (node = cgraph_node (decl); node; node = node-next_clone) 1212 if (node-global.inlined_to) 1213 return true; 1214 return false; 1215 } into bool cgraph_preserve_function_body_p (tree decl) { struct cgraph_node *node; /* Keep the body; we're going to dump it. */ if (dump_enabled_p (TDI_tree_all)) return true; if (!cgraph_global_info_ready !((DECL_INLINE (decl) !flag_really_no_inline))){ for (node = cgraph_node (decl); node; node = node-next_clone) if (node-global.local.disregard_inline_limits) return true; return false; } /* Look if there is any clone around. */ for (node = cgraph_node (decl); node; node = node-next_clone) if (node-global.inlined_to) return true; return false; } best regards Zhouyi Zhou -- Summary: C handling of always_inline attribute error and a solution Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zhouyi04 at ios dot cn GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31077