From patchwork Thu Oct 28 14:50:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1547550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=yV3PPXk9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hg7qs165fz9s1l for ; Fri, 29 Oct 2021 01:54:17 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9038C3858416 for ; Thu, 28 Oct 2021 14:54:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9038C3858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635432854; bh=ttES4DA5sNVlO7Y/4ZqTiSR3khfAKSH0CFCpbTdSx8o=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=yV3PPXk9+cfDG8BdQHaLtr6SOh1ufapjw9xWdkb6A04WjChjQ+3AaOMggUNjnn7wt S0/xY1g/AgCyjZIJef+/pUaW90KZ3DAtWC/rgQ9TgjL+EB7m5lbWnLNTQMCH/Cu7eW NkRDh2nVPeS0nEbEisGGDzII/YeKtdPVppjPDKzQ= 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 409CB3857824 for ; Thu, 28 Oct 2021 14:50:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 409CB3857824 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-438-Nl6zLFTUNcyF1WbpRG8aVA-1; Thu, 28 Oct 2021 10:50:55 -0400 X-MC-Unique: Nl6zLFTUNcyF1WbpRG8aVA-1 Received: by mail-qt1-f197.google.com with SMTP id c19-20020ac81e93000000b002a71180fd3dso4561025qtm.1 for ; Thu, 28 Oct 2021 07:50:55 -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=ttES4DA5sNVlO7Y/4ZqTiSR3khfAKSH0CFCpbTdSx8o=; b=di92l2rQgW3DUNaD54oXNWPniQgrL1FLUyiJomVRx7xhsq/llhW1w4bIV2XNZ1Ord9 OLhnySVsiuc1/04+s3vIUaKXJZ8Gkg9GzzybCeS8Sn3fNEXifut5usLnL+1Qumh/rUNJ Ic+zyq6WF/ISfIcR2q/4NvXXBPAzk/7aaJo/Fx0/nK0tzz1XEgnRuqmK0PDETQ78Hbah ylIsjHRMstQtgBOHZ8HMyjtdtRMj0lgevPg1irV6FjBYOAajuuXwv3EZWYjOhN5Vdor2 au7bXVuo/gL0u5JZJFKDoS6ONS8LWGsqqbMYAo6nS4KOBCJK9UurR7ZTSlu5TROPHNJW 9LDA== X-Gm-Message-State: AOAM530PmMA0nPxb/1DNuQveC/+gcpbN1dCsipL+ilug2L9dn6TxGQcd cDNNvBSLVhagQP760UAT4LPmW59O40k31QSw5ygByc111k10uPHaYxRYC9sQx987X8kcGzFI3FW MMwrEWQw0WJOBC8oApA== X-Received: by 2002:a05:6214:5186:: with SMTP id kl6mr4935247qvb.5.1635432655086; Thu, 28 Oct 2021 07:50:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzZy6QoK3wP1PuotUtnOHrcS/Jypr/j7miiWnQnkDrY40yb2LqsnDFeJ9sM6dMTGKYqPfbow== X-Received: by 2002:a05:6214:5186:: with SMTP id kl6mr4935243qvb.5.1635432654966; Thu, 28 Oct 2021 07:50:54 -0700 (PDT) Received: from [192.168.0.102] ([192.24.49.122]) by smtp.gmail.com with ESMTPSA id 12sm2230942qty.9.2021.10.28.07.50.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Oct 2021 07:50:54 -0700 (PDT) To: gcc-patches Subject: [COMMITTED] Unify EVRP and VRP folding predicate message. Message-ID: Date: Thu, 28 Oct 2021 10:50:52 -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.6 required=5.0 tests=BAYES_00, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" When EVRP folds a predicate it reports it only with TDF_DETAILS set as:     Predicate evaluates to: 0 VRP on the other hand always reports it to a dump_file as:     Folding predicate c_10 > 6 to 0 This patch changes fold_cond() in the simplifier to use the latter format, and converts a couple of EVRP tests to expect the new format. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From a6bbf1cc9f2847115543d720a99152d7dc2c4892 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 26 Oct 2021 13:19:05 -0400 Subject: [PATCH 2/3] Unify EVRP and VRP folding predicate message. EVRP issues a message fior folding predicates in a different format than VRP does, this patch unifies the messaging. gcc/ * vr-values.c (simplify_using_ranges::fold_cond): Change fold message. gcc/testsuite/ * gcc.dg/tree-ssa/evrp9.c: Adjust message scanned for. * gcc.dg/tree-ssa/pr21458-2.c: Ditto. --- gcc/testsuite/gcc.dg/tree-ssa/evrp9.c | 6 ++++-- gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c | 2 +- gcc/vr-values.c | 14 ++++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp9.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp9.c index 6e7828e4340..fb7c319fc43 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/evrp9.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp9.c @@ -24,5 +24,7 @@ foo (unsigned int x, unsigned int y) bar (); } -/* { dg-final { scan-tree-dump-not "== 5" "evrp" } } */ -/* { dg-final { scan-tree-dump-not "== 6" "evrp" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate minv_.* == 5 to 0" 1 "evrp" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate minv_.* == 6 to 0" 1 "evrp" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate maxv_.* == 5 to 0" 1 "evrp" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate maxv_.* == 6 to 0" 1 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c index f8d7353fc0e..9610570e272 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c @@ -16,4 +16,4 @@ foo (int a) } } -/* { dg-final { scan-tree-dump-times "Predicate evaluates to: 1" 1 "evrp" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate.* to 1" 1 "evrp" } } */ diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 00246c9d3af..ea925f7559d 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -3495,12 +3495,18 @@ simplify_using_ranges::fold_cond (gcond *cond) if (TREE_CODE (gimple_cond_lhs (cond)) != SSA_NAME && TREE_CODE (gimple_cond_rhs (cond)) != SSA_NAME) return false; + if (dump_file) + { + fprintf (dump_file, "Folding predicate "); + print_gimple_expr (dump_file, cond, 0); + fprintf (dump_file, " to "); + } edge e0 = EDGE_SUCC (gimple_bb (cond), 0); edge e1 = EDGE_SUCC (gimple_bb (cond), 1); if (r.zero_p ()) { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "\nPredicate evaluates to: 0\n"); + if (dump_file) + fprintf (dump_file, "0\n"); gimple_cond_make_false (cond); if (e0->flags & EDGE_TRUE_VALUE) set_and_propagate_unexecutable (e0); @@ -3509,8 +3515,8 @@ simplify_using_ranges::fold_cond (gcond *cond) } else { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "\nPredicate evaluates to: 1\n"); + if (dump_file) + fprintf (dump_file, "1\n"); gimple_cond_make_true (cond); if (e0->flags & EDGE_FALSE_VALUE) set_and_propagate_unexecutable (e0); -- 2.17.2