public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Jeff Law <law@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 6/9] df selftests
Date: Fri, 16 Sep 2016 21:34:00 -0000	[thread overview]
Message-ID: <1474061326.6782.100.camel@redhat.com> (raw)
In-Reply-To: <2340d901-2800-2fc8-7b86-42f7897ad896@redhat.com>

On Fri, 2016-09-16 at 14:34 -0600, Jeff Law wrote:
> On 09/08/2016 06:30 PM, David Malcolm wrote:
> > gcc/ChangeLog:
> > 	* df-core.c: Include selftest.h and selftest-rtl.h.
> > 	(selftest::dataflow_test::dataflow_test): New ctor.
> > 	(selftest::dataflow_test::~dataflow_test): New dtor.
> > 	(selftest::test_df_single_set): New function.
> > 	(selftest::df_core_c_tests): New function.
> > 	* selftest-run-tests.c (selftest::run_tests): Call it.
> > 	* selftest.h (selftest::df_core_c_tests): New decl.
> > ---
> >  gcc/df-core.c            | 77
> > ++++++++++++++++++++++++++++++++++++++++++++++++
> >  gcc/selftest-run-tests.c |  1 +
> >  gcc/selftest.h           |  1 +
> >  3 files changed, 79 insertions(+)
> > 
> > diff --git a/gcc/df-core.c b/gcc/df-core.c
> > index e531d58..cb8e2f9 100644
> > --- a/gcc/df-core.c
> > +++ b/gcc/df-core.c
> > @@ -384,6 +384,8 @@ are write-only operations.
> >  #include "cfganal.h"
> >  #include "tree-pass.h"
> >  #include "cfgloop.h"
> > +#include "selftest.h"
> > +#include "selftest-rtl.h"
> > 
> >  static void *df_get_bb_info (struct dataflow *, unsigned int);
> >  static void df_set_bb_info (struct dataflow *, unsigned int, void
> > *);
> > @@ -2482,3 +2484,78 @@ debug_df_chain (struct df_link *link)
> >    df_chain_dump (link, stderr);
> >    fputc ('\n', stderr);
> >  }
> > +
> > +#if CHECKING_P
> > +
> > +namespace selftest {
> > +
> > +/* dataflow_test's constructor.  Initialize df.  */
> > +
> > +dataflow_test::dataflow_test ()
> > +{
> > +  rest_of_handle_df_initialize ();
> > +}
> > +
> > +/* dataflow_test's destructor.  Clean up df.  */
> > +
> > +dataflow_test::~dataflow_test ()
> > +{
> > +  rest_of_handle_df_finish ();
> > +}
> > +
> > +/* Verify df_note on a trivial function.  */
> > +
> > +void
> > +test_df_single_set ()
> > +{
> > +  const char *input_dump
> > +    = "(insn 1 0 0 2 (set (reg:SI 100) (reg:SI 101)) -1 (nil))\n";
> > +  rtl_dump_test t (input_dump, 100);
> > +  //print_rtl_with_bb (stdout, get_insns (), 1024);
> Obviously this call to pritn_rtl_with_bb should disappear...
> 
> 
> > +
> > +  dataflow_test dftest;
> > +
> > +  df_note_add_problem ();
> > +  df_analyze ();
> > +  //df_dump (stderr);
> ANd this call to df_dump.
> 
> > +
> > +  ASSERT_EQ (SET_SRC (PATTERN (insn)), note0->element ());
> > +  ASSERT_EQ (REG_DEAD, REG_NOTE_KIND (note0));
> > +
> > +  ASSERT_EQ (SET_DEST (PATTERN (insn)), note1->element ());
> > +  ASSERT_EQ (REG_UNUSED, REG_NOTE_KIND (note1));
> I don't think the ordering of the notes is guaranteed.
> 
> Like the other RTL test I've looked at, I'd be real curious to know
> if 
> you get any uninitialized memory reads if you run this test under
> valgrind.

FWIW there don't seem to be any.

  reply	other threads:[~2016-09-16 21:28 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09  0:01 [PATCH 0/9] RFC: selftests based on RTL dumps David Malcolm
2016-09-09  0:01 ` [PATCH 6/9] df selftests David Malcolm
2016-09-16 20:40   ` Jeff Law
2016-09-16 21:34     ` David Malcolm [this message]
2016-09-09  0:01 ` [PATCH 9/9] cse.c selftests David Malcolm
2016-09-16 20:34   ` Jeff Law
2016-09-16 21:28     ` David Malcolm
2016-09-19 17:37       ` Jeff Law
2016-09-22  3:23         ` [PATCH] Introduce selftest::locate_file David Malcolm
2016-09-28 16:33           ` Jeff Law
2016-09-09  0:01 ` [PATCH 4/9] Expose forcibly_ggc_collect and run it after all selftests David Malcolm
2016-09-16 20:30   ` Jeff Law
2016-09-09  0:01 ` [PATCH 3/9] selftest.h: add temp_override fixture David Malcolm
2016-09-14 22:24   ` Trevor Saunders
2016-09-16 20:37   ` Jeff Law
2016-09-09  0:01 ` [PATCH 7/9] combine.c selftests David Malcolm
2016-09-16 20:45   ` Jeff Law
2016-09-16 21:39     ` David Malcolm
2016-09-09  0:01 ` [PATCH 2/9] Add selftest::read_file David Malcolm
2016-09-16 21:19   ` Jeff Law
2016-09-09  0:01 ` [PATCH 8/9] final.c selftests David Malcolm
2016-09-16 21:12   ` Jeff Law
2016-09-16 21:41     ` David Malcolm
2016-09-19 21:38       ` Jeff Law
2016-09-09  0:01 ` [PATCH 1/9] Introduce class rtx_reader David Malcolm
2016-09-16 22:15   ` Jeff Law
2016-09-21 17:22     ` [PATCH, v2] " David Malcolm
2016-09-21 20:44       ` Richard Sandiford
2016-09-09  0:13 ` [PATCH 5/9] Introduce class function_reader David Malcolm
2016-09-16 21:31   ` Jeff Law
2016-09-16 22:04     ` David Malcolm
2016-09-19 21:39       ` Jeff Law
2016-09-12 14:14 ` [PATCH 0/9] RFC: selftests based on RTL dumps Bernd Schmidt
2016-09-12 18:59   ` David Malcolm
2016-09-13 11:35     ` Bernd Schmidt
2016-09-14 10:33       ` Bernd Schmidt
2016-09-16 20:26       ` Jeff Law
2016-09-16 21:28         ` David Malcolm
2016-09-19 17:50           ` Jeff Law
2016-09-20 14:34             ` Register numbers in RTL dumps (was Re: [PATCH 0/9] RFC: selftests based on RTL dumps) David Malcolm
2016-09-20 14:38               ` Bernd Schmidt
2016-09-20 15:26                 ` Jeff Law
2016-09-20 15:38                   ` Bernd Schmidt
2016-09-20 19:35                   ` David Malcolm
2016-09-21 18:59                     ` [PATCH] print-rtx.c: add 'h', v' and 'p' prefixes to regnos David Malcolm
2016-09-28 16:30                       ` Jeff Law
2016-09-28 16:33                         ` Bernd Schmidt
2016-09-28 17:11                           ` Jeff Law
2016-09-28 17:19                             ` Bernd Schmidt
2016-09-29 13:00                               ` David Malcolm
2016-09-29 17:32                               ` Jeff Law
2016-09-13 20:39     ` [PATCH 0/9] RFC: selftests based on RTL dumps Jeff Law
2016-09-14  8:44       ` Richard Biener
2016-09-16 20:16         ` Jeff Law
2016-09-16 21:27           ` David Malcolm
2016-09-19 12:21             ` Bernd Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474061326.6782.100.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).