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