On 09/08/2016 06:30 PM, David Malcolm wrote:
gcc/ChangeLog:
* combine.c: Include selftest.h and selftest-rtl.h.
(try_combine): Add assertion on this_basic_block.
(class selftest::combine_test): New subclass of
selftest::tl_dump_test.
(selftest::combine_test::combine_test): New ctor.
(selftest::test_combining_shifts): New function.
(selftest::test_non_combinable_shifts): New function.
(selftest::combine_c_tests): New function.
* selftest-run-tests.c (selftest::run_tests): Run
selftest::combine_c_tests.
* selftest.h (selftest::combine_c_tests): New decl.
diff --git a/gcc/combine.c b/gcc/combine.c
index 1b262f9..9c148bb 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2625,6 +2627,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1,
rtx_insn *i0,
rtx new_other_notes;
int i;
+ gcc_assert (this_basic_block);
Presumably when you set up the self test the first time this was NULL :-)
+
+/* combine_test's constructor. Write DUMP_CONTENT to a tempfile and load
+ it. Initialize df and perform dataflow analysis. */
+
+combine_test::combine_test (const char *dump_content,
+ int dumped_first_pseudo_regno)
+: rtl_dump_test (dump_content, dumped_first_pseudo_regno),
+ m_df_test ()
+{
+ /* The dataflow instance should have been created by m_df_test's ctor. */
+ gcc_assert (df);
+
+ /* From rest_of_handle_combine. */
+ df_set_flags (/*DF_LR_RUN_DCE + */ DF_DEFER_INSN_RESCAN);
+ df_note_add_problem ();
+ df_analyze ();
+}
So rather than taking a string (which is a pain to construct), then
writing it out to a file, then reading it in, what's wrong with having
RTL fragments in a file?
Jeff