Valgrind showed a per-iteration leak of pass_ipa_pta (and presumably pass_omp_simd_clone):
704 (352 direct, 352 indirect) bytes in 4 blocks are definitely lost in loss record 198 of 241 at 0x4A06965: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x555A55D: make_pass_ipa_pta(gcc::context*) (tree-ssa-structalias.c:7425) by 0x5219FDA: gcc::pass_manager::pass_manager(gcc::context*) (pass-instances.def:141) by 0x4E4F5D1: gcc::context::context() (context.c:37) by 0x532C07B: general_init(char const*) (toplev.c:1212) by 0x532DB5E: toplev::main(int, char**) (toplev.c:2074) by 0x4DE76AF: gcc::jit::playback::context::compile() (jit-playback.c:1615) by 0x4DD76DA: gcc::jit::recording::context::compile() (jit-recording.c:861) by 0x4DD5BD2: gcc_jit_context_compile (libgccjit.c:2014) by 0x401DC4: test_jit (harness.h:190) by 0x401EA8: main (harness.h:232) Investigation showed that ~pass_manager wasn't deleting these passes since for some reason GCC_PASS_LISTS didn't contain all_late_ipa_passes and so wasn't calling delete_pass_tree on it. Add it to GCC_PASS_LISTS, fixing the leak. gcc/ChangeLog: PR jit/63854 * pass_manager.h (GCC_PASS_LISTS): Add all_late_ipa_passes. --- gcc/pass_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h index 82857a9..e6658ad 100644 --- a/gcc/pass_manager.h +++ b/gcc/pass_manager.h @@ -29,6 +29,7 @@ struct register_pass_info; DEF_PASS_LIST (all_lowering_passes) \ DEF_PASS_LIST (all_small_ipa_passes) \ DEF_PASS_LIST (all_regular_ipa_passes) \ + DEF_PASS_LIST (all_late_ipa_passes) \ DEF_PASS_LIST (all_passes) #define DEF_PASS_LIST(LIST) PASS_LIST_NO_##LIST, -- 1.8.5.3