[Bug ipa/78494] New: Issues pointed out by valgrind --tool=exp-dhat

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 23 14:21:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78494

            Bug ID: 78494
           Summary: Issues pointed out by valgrind --tool=exp-dhat
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

Running, e.g.:
% valgrind --tool=exp-dhat
/var/tmp/gcc_test/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1plus
-quiet -v -iprefix
/var/tmp/gcc_test/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/7.0.0/
-D_GNU_SOURCE tramp3d-v4.cpp -quiet -dumpbase tramp3d-v4.cpp -mtune=generic
-march=x86-64 -auxbase tramp3d-v4 -Ofast -w -version /tmp/ccrdBsk6.s

Shows:

==27457== ======== SUMMARY STATISTICS ========
==27457==
==27457== guest_insns:  196,805,402,120
==27457==
==27457== max_live:     27,271,475 in 125,424 blocks
==27457==
==27457== tot_alloc:    6,718,942,575 in 38,913,111 blocks
==27457==
==27457== insns per allocated byte: 29
==27457==
==27457==
==27457== ======== ORDERED BY decreasing "max-bytes-live": top 10 allocators
========
==27457==
==27457== -------------------- 1 of 10 --------------------
==27457== max-live:    4,194,296 in 1 blocks
==27457== tot-alloc:   4,194,296 in 1 blocks (avg size 4194296.00)
==27457== deaths:      none (none of these blocks were freed)
==27457== acc-ratios:  3.62 rd, 1.17 wr  (15,192,712 b-read, 4,935,920
b-written)
==27457==    at 0x402F015: calloc (vg_replace_malloc.c:711)
==27457==    by 0x15F4D90: xcalloc (xmalloc.c:163)
==27457==    by 0x15F1EFC: htab_expand (hashtab.c:550)
==27457==    by 0x15F25E9: htab_find_slot_with_hash (hashtab.c:645)
==27457==    by 0x15BDFAC: get_combined_adhoc_loc(line_maps*, unsigned int,
source_range, void*) (line-map.c:216)
==27457==    by 0x102D6B5: set_block(unsigned int, tree_node*)
(line-map.h:1020)
==27457==    by 0x102D6F5: tree_set_block(tree_node*, tree_node*)
(tree.c:12089)
==27457==    by 0xDF53EA: remap_gimple_op_r(tree_node**, int*, void*)
(tree-inline.c:1031)
==27457==    by 0x1040BF2: walk_tree_1(tree_node**, tree_node* (*)(tree_node**,
int*, void*), void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_n
ode**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*)) (tree.c:11723)
==27457==    by 0xAE63ED: walk_gimple_op(gimple*, tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*) (gimple-walk.c:244)
==27457==    by 0xDEFB90: remap_gimple_stmt(gimple*, copy_body_data*)
(tree-inline.c:1770)
==27457==    by 0xDF0B06: copy_bb(copy_body_data*, basic_block_def*, int, long)
(tree-inline.c:1828)
==27457==
==27457== -

richi pointed out on IRC that replacing TREE_SET_BLOCK (*tp, new_block) with
TREE_SET_BLOCK (*tp, NULL) in remap_gimple_op_r (gcc/tree-inline.c:1031) might
help:

==4991== ======== ORDERED BY decreasing "max-bytes-live": top 10 allocators
========
==4991==
==4991== -------------------- 1 of 10 --------------------
==4991== max-live:    4,194,296 in 1 blocks
==4991== tot-alloc:   4,194,296 in 1 blocks (avg size 4194296.00)
==4991== deaths:      none (none of these blocks were freed)
==4991== acc-ratios:  1.06 rd, 0.48 wr  (4,454,960 b-read, 2,037,936 b-written)
==4991==    at 0x402F015: calloc (vg_replace_malloc.c:711)
==4991==    by 0x15F4D10: xcalloc (xmalloc.c:163)
==4991==    by 0x15F1E7C: htab_expand (hashtab.c:550)
==4991==    by 0x15F2569: htab_find_slot_with_hash (hashtab.c:645)
==4991==    by 0x15BDF2C: get_combined_adhoc_loc(line_maps*, unsigned int,
source_range, void*) (line-map.c:216)
==4991==    by 0x102D635: set_block(unsigned int, tree_node*) (line-map.h:1020)
==4991==    by 0xDEF6BD: remap_gimple_stmt(gimple*, copy_body_data*)
(gimple.h:1758)
==4991==    by 0xDF0AB6: copy_bb(copy_body_data*, basic_block_def*, int, long)
(tree-inline.c:1828)
==4991==    by 0xDF210C: copy_body(copy_body_data*, long, int,
basic_block_def*, basic_block_def*, basic_block_def*) (tree-inline.c:2773)
==4991==    by 0xDF77A0: expand_call_inline(basic_block_def*, gimple*,
copy_body_data*) (tree-inline.c:4751)
==4991==    by 0xDF975C: optimize_inline_calls(tree_node*) (tree-inline.c:4896)
==4991==    by 0x14E0231: early_inliner(function*) (ipa-inline.c:2721)

Now only 48% of the allocation is actually written to (acc-ratios: 0.48 wr).

Another possible leak:

==4991== -------------------- 10 of 10 --------------------
==4991== max-live:    1,048,576 in 1 blocks
==4991== tot-alloc:   1,048,576 in 1 blocks (avg size 1048576.00)
==4991== deaths:      none (none of these blocks were freed)
==4991== acc-ratios:  5.87 rd, 0.78 wr  (6,165,008 b-read, 825,104 b-written)
==4991==    at 0x402F015: calloc (vg_replace_malloc.c:711)
==4991==    by 0x15F4D10: xcalloc (xmalloc.c:163)
==4991==    by 0x15C6688: ht_lookup_with_hash(ht*, unsigned char const*,
unsigned long, unsigned int, ht_lookup_option) (symtab.c:188)
==4991==    by 0xD6EB27: get_identifier(char const*) (stringpool.c:110)
==4991==    by 0xAC8CB1: create_tmp_var_name(char const*) (gimple-expr.c:427)
==4991==    by 0xAC8CEA: create_tmp_var_raw(tree_node*, char const*)
(gimple-expr.c:438)
==4991==    by 0xF4301F: run_scc_vn(vn_lookup_kind) (tree-ssa-sccvn.c:4383)
==4991==    by 0xF10155: (anonymous namespace)::pass_fre::execute(function*)
(tree-ssa-pre.c:5151)
==4991==    by 0xCA0793: execute_one_pass(opt_pass*) (passes.c:2370)
==4991==    by 0xCA0EB0: execute_pass_list_1(opt_pass*) (passes.c:2459)
==4991==    by 0xCA0EC2: execute_pass_list_1(opt_pass*) (passes.c:2460)
==4991==    by 0xCA0F0C: execute_pass_list(function*, opt_pass*)
(passes.c:2470)


More information about the Gcc-bugs mailing list