Fix profile updating after outer loop unswitching

Martin Liška mliska@suse.cz
Tue Feb 14 11:25:00 GMT 2017


On 02/05/2017 06:28 PM, Jan Hubicka wrote:
> +  /* ... finally scale everything in the loop except for guarded basic blocks
> +     where profile does not change.  */
> +  basic_block *body = get_loop_body (loop);

Hello.

This hunk causes a new memory leak:

==24882== 64 bytes in 1 blocks are definitely lost in loss record 328 of 892

==24882==    at 0x4C29110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)

==24882==    by 0x115DFF7: xmalloc (xmalloc.c:147)

==24882==    by 0x6FADCC: get_loop_body(loop const*) (cfgloop.c:834)

==24882==    by 0xB77520: hoist_guard (tree-ssa-loop-unswitch.c:881)

==24882==    by 0xB77520: tree_unswitch_outer_loop (tree-ssa-loop-unswitch.c:536)

==24882==    by 0xB77520: tree_ssa_unswitch_loops() (tree-ssa-loop-unswitch.c:104)

==24882==    by 0x99C65E: execute_one_pass(opt_pass*) (passes.c:2465)

==24882==    by 0x99CE17: execute_pass_list_1(opt_pass*) (passes.c:2554)

==24882==    by 0x99CE29: execute_pass_list_1(opt_pass*) (passes.c:2555)

==24882==    by 0x99CE29: execute_pass_list_1(opt_pass*) (passes.c:2555)

==24882==    by 0x99CE74: execute_pass_list(function*, opt_pass*) (passes.c:2565)

==24882==    by 0x71E745: cgraph_node::expand() (cgraphunit.c:2038)

==24882==    by 0x71FCC3: expand_all_functions (cgraphunit.c:2174)

==24882==    by 0x71FCC3: symbol_table::compile() (cgraphunit.c:2531)

==24882==    by 0x7214DB: symbol_table::finalize_compilation_unit() (cgraphunit.c:2621)

==24882==    by 0xA5B3AB: compile_file() (toplev.c:492)

==24882==    by 0x5F3A78: do_compile (toplev.c:1984)

==24882==    by 0x5F3A78: toplev::main(int, char**) (toplev.c:2118)

==24882==    by 0x5F5826: main (main.c:39)


Fixed in attached patch that can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-memory-leak-in-tree-ssa-loop-unswitch.c.patch
Type: text/x-patch
Size: 1786 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170214/9f314391/attachment.bin>


More information about the Gcc-patches mailing list