From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44745 invoked by alias); 16 Sep 2016 20:40:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 44713 invoked by uid 89); 16 Sep 2016 20:40:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1720 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Sep 2016 20:40:31 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 165119E610 for ; Fri, 16 Sep 2016 20:40:30 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-2.phx2.redhat.com [10.3.116.2]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8GKeT0B028804; Fri, 16 Sep 2016 16:40:29 -0400 Subject: Re: [PATCH 7/9] combine.c selftests To: David Malcolm , gcc-patches@gcc.gnu.org References: <1473381053-18817-1-git-send-email-dmalcolm@redhat.com> <1473381053-18817-8-git-send-email-dmalcolm@redhat.com> From: Jeff Law Message-ID: Date: Fri, 16 Sep 2016 20:45:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1473381053-18817-8-git-send-email-dmalcolm@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg01094.txt.bz2 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