Support running the selftests under valgrind
gcc/ChangeLog: * Makefile.in (selftest-valgrind): New phony target. * function-tests.c (selftest::build_cfg): Delete pass instances created by the test. (selftest::convert_to_ssa): Likewise. (selftest::test_expansion_to_rtl): Likewise. * tree-cfg.c (selftest::test_linear_chain): Release dominator vectors. (selftest::test_diamond): Likewise. From-SVN: r238209
This commit is contained in:
parent
f51606c71a
commit
9e34db2e03
@ -1,3 +1,14 @@
|
||||
2016-07-11 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* Makefile.in (selftest-valgrind): New phony target.
|
||||
* function-tests.c (selftest::build_cfg): Delete pass instances
|
||||
created by the test.
|
||||
(selftest::convert_to_ssa): Likewise.
|
||||
(selftest::test_expansion_to_rtl): Likewise.
|
||||
* tree-cfg.c (selftest::test_linear_chain): Release dominator
|
||||
vectors.
|
||||
(selftest::test_diamond): Likewise.
|
||||
|
||||
2016-07-11 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/71816
|
||||
|
@ -1869,6 +1869,12 @@ s-selftest: $(GCC_PASSES) cc1$(exeext) stmp-int-hdrs
|
||||
selftest-gdb: $(GCC_PASSES) cc1$(exeext) stmp-int-hdrs
|
||||
$(GCC_FOR_TARGET) -xc -S -c /dev/null -fself-test -wrapper gdb,--args
|
||||
|
||||
# Convenience method for running selftests under valgrind:
|
||||
.PHONY: selftest-valgrind
|
||||
selftest-valgrind: $(GCC_PASSES) cc1$(exeext) stmp-int-hdrs
|
||||
$(GCC_FOR_TARGET) -xc -S -c /dev/null -fself-test \
|
||||
-wrapper valgrind,--leak-check=full
|
||||
|
||||
# Recompile all the language-independent object files.
|
||||
# This is used only if the user explicitly asks for it.
|
||||
compilations: $(BACKEND)
|
||||
|
@ -296,6 +296,7 @@ build_cfg (tree fndecl)
|
||||
push_cfun (fun);
|
||||
lower_cf_pass->execute (fun);
|
||||
pop_cfun ();
|
||||
delete lower_cf_pass;
|
||||
|
||||
/* We can now convert to CFG form; for our trivial test function this
|
||||
gives us:
|
||||
@ -310,6 +311,7 @@ build_cfg (tree fndecl)
|
||||
push_cfun (fun);
|
||||
build_cfg_pass->execute (fun);
|
||||
pop_cfun ();
|
||||
delete build_cfg_pass;
|
||||
}
|
||||
|
||||
/* Convert a gimple+CFG function to SSA form. */
|
||||
@ -325,6 +327,7 @@ convert_to_ssa (tree fndecl)
|
||||
push_cfun (fun);
|
||||
build_ssa_pass->execute (fun);
|
||||
pop_cfun ();
|
||||
delete build_ssa_pass;
|
||||
}
|
||||
|
||||
/* Assuming we have a simple 3-block CFG like this:
|
||||
@ -594,6 +597,7 @@ test_expansion_to_rtl ()
|
||||
init_function_start (fndecl);
|
||||
expand_pass->execute (fun);
|
||||
pop_cfun ();
|
||||
delete expand_pass;
|
||||
|
||||
/* On x86_64, I get this:
|
||||
(note 3 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
|
||||
|
@ -9276,6 +9276,7 @@ test_linear_chain ()
|
||||
ASSERT_EQ (1, dom_by_b.length ());
|
||||
ASSERT_EQ (bb_c, dom_by_b[0]);
|
||||
free_dominance_info (CDI_DOMINATORS);
|
||||
dom_by_b.release ();
|
||||
|
||||
/* Similarly for post-dominance: each BB in our chain is post-dominated
|
||||
by the one after it. */
|
||||
@ -9286,6 +9287,7 @@ test_linear_chain ()
|
||||
ASSERT_EQ (1, postdom_by_b.length ());
|
||||
ASSERT_EQ (bb_a, postdom_by_b[0]);
|
||||
free_dominance_info (CDI_POST_DOMINATORS);
|
||||
postdom_by_b.release ();
|
||||
|
||||
pop_cfun ();
|
||||
}
|
||||
@ -9346,8 +9348,10 @@ test_diamond ()
|
||||
ASSERT_EQ (bb_a, get_immediate_dominator (CDI_DOMINATORS, bb_d));
|
||||
vec<basic_block> dom_by_a = get_dominated_by (CDI_DOMINATORS, bb_a);
|
||||
ASSERT_EQ (3, dom_by_a.length ()); /* B, C, D, in some order. */
|
||||
dom_by_a.release ();
|
||||
vec<basic_block> dom_by_b = get_dominated_by (CDI_DOMINATORS, bb_b);
|
||||
ASSERT_EQ (0, dom_by_b.length ());
|
||||
dom_by_b.release ();
|
||||
free_dominance_info (CDI_DOMINATORS);
|
||||
|
||||
/* Similarly for post-dominance. */
|
||||
@ -9357,8 +9361,10 @@ test_diamond ()
|
||||
ASSERT_EQ (bb_d, get_immediate_dominator (CDI_POST_DOMINATORS, bb_c));
|
||||
vec<basic_block> postdom_by_d = get_dominated_by (CDI_POST_DOMINATORS, bb_d);
|
||||
ASSERT_EQ (3, postdom_by_d.length ()); /* A, B, C in some order. */
|
||||
postdom_by_d.release ();
|
||||
vec<basic_block> postdom_by_b = get_dominated_by (CDI_POST_DOMINATORS, bb_b);
|
||||
ASSERT_EQ (0, postdom_by_b.length ());
|
||||
postdom_by_b.release ();
|
||||
free_dominance_info (CDI_POST_DOMINATORS);
|
||||
|
||||
pop_cfun ();
|
||||
|
Loading…
Reference in New Issue
Block a user