From patchwork Wed Nov 3 14:39:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 46996 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F34E93858005 for ; Wed, 3 Nov 2021 14:43:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F34E93858005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635950586; bh=jFn4OimPv37dRWPxCMyZOYlpqqQn9LnhZZ8iMGxRbME=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=wD2nuwP+dZOpWeGXjzi8WwSphMmowGkIbSwspFrVIpeeILh10Xw8OEXjHchnsNsHJ /bMsXyE8hxyQyguW50Gedjrrewnp3Mx1p1lcGgJIg/xi/Mqw/BnuKZNseCbjWIzH7w gSiMUujw3ekHk3YzJaQn2QAIy0hoftOnB3ObYutk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 1BE03385800B for ; Wed, 3 Nov 2021 14:39:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1BE03385800B Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-psmLF5SgOfqNCzeeRTBqUg-1; Wed, 03 Nov 2021 10:39:54 -0400 X-MC-Unique: psmLF5SgOfqNCzeeRTBqUg-1 Received: by mail-qt1-f198.google.com with SMTP id w12-20020ac80ecc000000b002a7a4cd22faso762245qti.4 for ; Wed, 03 Nov 2021 07:39:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language; bh=jFn4OimPv37dRWPxCMyZOYlpqqQn9LnhZZ8iMGxRbME=; b=KPv7S+OwxflCYz36k+kkWZg2HP+lZoEyDqBOne8Nq6BfLh0kCS0Qn4ygzjIrGAPbbM NsA0YWBKOAL+feDByj/vT2OqusXDmQtjsz64PC0LjrvtbnZSpdmMr8Xcl/y4voaFHz65 fLAVuN2hbMx2Rta1Y/9R6ZQrL+JyGXZlq0i9awRulspoH661im/Oq/0494vQ4WsmoUX7 NTsaJZxJCZxVbHQ8rrlI7B+jPxIMsPtGXyVyC1eexr/JBtJ4Qk76ZjBPwiJMzC6UtB3+ lXbaHSEdn795Kq5F19a6buI8+qlcTUt8I6wsU9FnGUQz2ykOV1lQjRE2SwYTV+PrJMnN xCKQ== X-Gm-Message-State: AOAM5333xPXoDkO6yiQOBExK8CqyZilRB6jkk8NQDU7/XXnks/e7azhX Whh4Sgd5ggHbtyl9bqlZTykCHpwea5LhtUbFnOE2MauoTE8UOjJ9eJlqcWw/9Kbwm7a23Pn0ORw vtxb6+WOA7WtJRwFDjg== X-Received: by 2002:ac8:5d8c:: with SMTP id d12mr23641532qtx.191.1635950393980; Wed, 03 Nov 2021 07:39:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbx6UrRvDoJoBD2l4iP3C5nE+IZegQhnSTf6Mj1dv5tTPEoWwn7xVkYENvdG5wzzZfvXlZKQ== X-Received: by 2002:ac8:5d8c:: with SMTP id d12mr23641517qtx.191.1635950393778; Wed, 03 Nov 2021 07:39:53 -0700 (PDT) Received: from ?IPv6:2607:fea8:a262:5f00::38cf? ([2607:fea8:a262:5f00::38cf]) by smtp.gmail.com with ESMTPSA id l15sm1788592qtk.41.2021.11.03.07.39.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Nov 2021 07:39:52 -0700 (PDT) To: gcc-patches Subject: [COMMITTED] Testcase adjustments for pass vrp1. Message-ID: <922e773e-921b-333f-6540-e61f42612a58@redhat.com> Date: Wed, 3 Nov 2021 10:39:48 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-CA X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" The following tests all were checking something specific in VRP1 and with multiple versions available to run now, this patch unifies the checking so that they still check what it did before, verify the same code is produced, but does it in a more agnostic way.  This allows them to pass with both --param=vrp1-mode=vrp and --param=vrp1-mode=ranger. Specifically: * pr23744.c: don;'t look for the phrase "gimple_simplified", and ranger produces a "Folding predicate" from the propagation engine. Instead, verify that that here is exactly 1 "return 0" and no "return 1"s in the results. * vrp07.c: Don't look for the number of  "PREDICATE: p_" asserts that were inserted, the "Folding predicate" checks themselves are enough. * vrp08.c: Same thing. no need to verify the number of PREDICATE asserts. * vrp09.c: Change the      scan-tree-dump-times "Folding predicate p_.. != 0B to 1" 2 "vrp1" into 2 similar cehcks that allow for the difference in output that p_10(D) doesn't fit that pattern.  This also seems to show either a bug in dejagnu, or a lack in my understanding of wildcards... because allowing for the (D) at the end of p_10 implemented with a wildcard will not match more than 1 time.  I ran across this a couple of times, and notice there are no testacses which look for a '*' wildcard using scan-tree-dump-times with a value greater than 1... ie      scan-tree-dump-times "Folding predicate p_\.\* != 0B to 1" 1 "vrp1" Will match the sequence if it happens once in the file, but if it happens twice, and you use      scan-tree-dump-times "Folding predicate p_\.\* != 0B to 1" 2 "vrp1" It fails to match... Im not getting into that at the moment, so I simply added 2 checks without wildcards that work out to the equivalent thing. * vrp20.c: Adjust the checks to again allow for a possible (D) following the ssa_name in the listing. * vrp92.c: This testcase checked that an ssa_name specifically was given a global value of [1,1], and that no threading occurred.  Well, res actually folded away, and ranger doesn export globals values for ssa-names which no longer exist.  INstead , changes the checks to make sure that the resulting code from vrp1 has no PHIs, Ifs, or gotos. * jit.dg/test-sum-of-squares.c: The original was checking for a symbolic range.. Dmalcolm adjusted the testcase for me to accomplish his original goal without depending on symbolics. Thanks!! no regressions on x86_64-pc-linux-gnu,  pushed. Andrew From 1410b208013e4ccd9438cda178c7ea995684e7e8 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 1 Nov 2021 16:20:23 -0400 Subject: [PATCH 5/6] Testcase adjustments for pass vrp1. Unify testcases for the vrp1 pass so they will work with the output from either VRP or ranger. gcc/testsuite/ * gcc.dg/tree-ssa/pr23744.c: Tweak output checks. * gcc.dg/tree-ssa/vrp07.c: Ditto. * gcc.dg/tree-ssa/vrp08.c: Ditto. * gcc.dg/tree-ssa/vrp09.c: Ditto. * gcc.dg/tree-ssa/vrp20.c: Ditto. * gcc.dg/tree-ssa/vrp92.c: Ditto. * jit.dg/test-sum-of-squares.c: Ditto. --- gcc/testsuite/gcc.dg/tree-ssa/pr23744.c | 5 +++-- gcc/testsuite/gcc.dg/tree-ssa/vrp07.c | 3 --- gcc/testsuite/gcc.dg/tree-ssa/vrp08.c | 1 - gcc/testsuite/gcc.dg/tree-ssa/vrp09.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/vrp20.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/vrp92.c | 7 ++++--- gcc/testsuite/jit.dg/test-sum-of-squares.c | 10 +++++----- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c index ba3fda352ca..f70f2546bf1 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-ccp -fdisable-tree-evrp -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fno-tree-ccp -fdisable-tree-evrp -fdump-tree-vrp1" } */ void h (void); @@ -17,4 +17,5 @@ int g (int i, int j) return 1; } -/* { dg-final { scan-tree-dump-times "gimple_simplified" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "return 0" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-not "return 1" "vrp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c index 9c4acd29681..ec5f6cce46f 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c @@ -34,6 +34,3 @@ foo (int i, int *p) /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ - -/* { dg-final { scan-tree-dump-times "PREDICATE: p_\[0-9\]" 2 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ -/* { dg-final { scan-tree-dump-times "PREDICATE: p_\[0-9\]" 1 "vrp1" { target { keeps_null_pointer_checks } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c index 4599fa7d533..c9d90236715 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c @@ -20,5 +20,4 @@ foo (int a, int *p) } /* Target disabling -fdelete-null-pointer-checks should not fold checks */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ -/* { dg-final { scan-tree-dump-times "PREDICATE: p_.* ne_expr 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c index 4e4954da32a..354169692d6 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c @@ -27,4 +27,5 @@ L78: } } -/* { dg-final { scan-tree-dump-times "Folding predicate p_.. != 0B to 1" 2 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate p_" 2 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "!= 0B to 1" 2 "vrp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c index f9df67ffb05..e5822992fe4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c @@ -23,5 +23,5 @@ int g (int b) { return 1; } -/* { dg-final { scan-tree-dump "Folding predicate a_. == 0 to 0" "vrp1" } } */ -/* { dg-final { scan-tree-dump "Folding predicate b_. != 0 to 1" "vrp1" } } */ +/* { dg-final { scan-tree-dump "Folding predicate a_\.\* == 0 to 0" "vrp1" } } */ +/* { dg-final { scan-tree-dump "Folding predicate b_\.\* != 0 to 1" "vrp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c index 66d74e9b5e9..9e53547dadc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdisable-tree-evrp -fno-tree-fre -fdump-tree-vrp1-details -fdisable-tree-ethread" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fno-tree-fre -fdump-tree-vrp1 -fdisable-tree-ethread" } */ void bar (void); int foo (int i, int j) @@ -18,5 +18,6 @@ int foo (int i, int j) return j; } -/* { dg-final { scan-tree-dump "res_.: int \\\[1, 1\\\]" "vrp1" } } */ -/* { dg-final { scan-tree-dump-not "Threaded" "vrp1" } } */ +/* { dg-final { scan-tree-dump-not "PHI" "vrp1" } } */ +/* { dg-final { scan-tree-dump-not "goto" "vrp1" } } */ +/* { dg-final { scan-tree-dump-not "if" "vrp1" } } */ diff --git a/gcc/testsuite/jit.dg/test-sum-of-squares.c b/gcc/testsuite/jit.dg/test-sum-of-squares.c index f095f419a59..cfcf5b2aac2 100644 --- a/gcc/testsuite/jit.dg/test-sum-of-squares.c +++ b/gcc/testsuite/jit.dg/test-sum-of-squares.c @@ -133,10 +133,10 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) An example of using gcc_jit_context_enable_dump to verify a property of the compile. - In this case, verify that vrp is able to deduce the - bounds of the iteration variable. Specifically, verify that some - variable is known to be in the range negative infinity to some - expression based on param "n" (actually n-1). */ - CHECK_STRING_CONTAINS (dump_vrp1, "[-INF, n_"); + In particular, this example verifies that we can read the dump from a + pass with multiple instances. Given that the format of the VRP dump + is subject to change, merely verify that it contains the function + name. */ + CHECK_STRING_CONTAINS (dump_vrp1, ";; Function loop_test"); free (dump_vrp1); } -- 2.17.2