From patchwork Thu Jun 16 18:19:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1644571 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=QXsTsoUB; 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 (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LP9SW64tNz9sGD for ; Fri, 17 Jun 2022 04:19:54 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 36B5A3834E74 for ; Thu, 16 Jun 2022 18:19:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36B5A3834E74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1655403591; bh=53s7J6H33J18bzogb6SNyWEGwfADNbn9ysmlmUe2Npw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QXsTsoUBKu5D40BU4K8h2+Xkvrzb0u5Zyn77Hp/RiZTGyXuxRX11te9DLqXLtUM8p ZZ2Cl8wih1QAc0fnOMtTRiC4NeHm51ekRfdYRGcmpj2OYTDj3mRON1zJB4GKfwMp6F kyqf0Qkjov6k1pMFpRJ08oTxnsawywsHW6o4F+WE= 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 CB5193858296 for ; Thu, 16 Jun 2022 18:19:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CB5193858296 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-nzUENb-5ODSWJ5lbO6ceTQ-1; Thu, 16 Jun 2022 14:19:21 -0400 X-MC-Unique: nzUENb-5ODSWJ5lbO6ceTQ-1 Received: by mail-qv1-f70.google.com with SMTP id q36-20020a0c9127000000b00461e3828064so2353221qvq.12 for ; Thu, 16 Jun 2022 11:19:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:from:subject; bh=7GlXjrThU+GMeMkav7hibfw00KOn+iy9eMGln7OHPao=; b=VbCUgHPOGWDJP2fXdQ6QruUPYumecgGd9Y6j4ttx/StV3ZL6PPXo8KVwPANFeLqwqa YyiUzCih1AMDoK2ktbVdauTYhdMxi/wBhZfwISlvgE64ZjHdoqQW1K4J1WpbEJ+tDxF7 VkCaHE21ABWHFj4shwg4be6kCmQRcvocM1hhiV6QVMcaggOANQXZrFGdc5mG+ONy4HCQ 8dSbkhuJ6dtXpkGfIXZxlrf6Hh9dUS+Fe3WNiB+SVwvUlcUkT8vT6TTG4Hp4hU/X4gzJ 14JgKTqYnaFOzIPhBHvxySXKmzqW4a78OAkwp8c9HNQZyIYemk/3uN/PzDKCgjtXYacY Fr/g== X-Gm-Message-State: AJIora/wknMFCVwHYWnpitcGbMeYqNAlWdbdtm1RoHwQm5ZcTIYMdK+v ASDJhDPmFo/L4vxYUs4aUvA1xv9YKsRlFQ+Lr5FM15k48LWmTzWOsbGQKy7AgA+M3TyUqxY5KSa zpTA3aLo8PFiqXvk7i35RJGTwZpTqxiEtC3GgCuJKGL82IyzITp/ORHwEEzkp8GfdRJ8h0w== X-Received: by 2002:a05:622a:391:b0:306:67e9:343f with SMTP id j17-20020a05622a039100b0030667e9343fmr5012172qtx.651.1655403560754; Thu, 16 Jun 2022 11:19:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sShUjuKjM68yJziT3Rr89VuxJggkWzM54bWvTnHIXbPYpRo3SzaEG9QaCe/7lPavLDEsc1jg== X-Received: by 2002:a05:622a:391:b0:306:67e9:343f with SMTP id j17-20020a05622a039100b0030667e9343fmr5012156qtx.651.1655403560446; Thu, 16 Jun 2022 11:19:20 -0700 (PDT) Received: from ?IPV6:2607:fea8:a261:5e00::b58? ([2607:fea8:a261:5e00::b58]) by smtp.gmail.com with ESMTPSA id de7-20020a05620a370700b0069fc13ce235sm2309592qkb.102.2022.06.16.11.19.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Jun 2022 11:19:18 -0700 (PDT) Message-ID: Date: Thu, 16 Jun 2022 14:19:16 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 To: gcc-patches Subject: [COMMITTED] Propagator should call value_of_stmt. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-CA X-Spam-Status: No, score=-12.8 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, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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 evaluating the LHS of a stmt, its more efficient/better to call value_of_stmt directly rather than value_of_expr.  The value_of_* routines are not quite as efficient as the range_of routines, plus value_of_expr will check if its a LHS, and invoke value_of_stmt if it is. This in fact speeds VRP up by about 1.5%... it bypasses some other stuff the value_of_expr checks that is not necessary. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From 5b1594dc2d053803ae98ae39f76fbd71f35cb657 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 31 Mar 2022 09:36:59 -0400 Subject: [PATCH 1/2] Propagator should call value_of_stmt. When evaluating the LHS of a stmt, its more efficent/better to call value_of_stmt directly rather than value_of_expr. * tree-ssa-propagate.cc (before_dom_children): Call value_of_stmt. --- gcc/tree-ssa-propagate.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc index c10ffd91766..5983f029364 100644 --- a/gcc/tree-ssa-propagate.cc +++ b/gcc/tree-ssa-propagate.cc @@ -813,7 +813,7 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) tree lhs = gimple_get_lhs (stmt); if (lhs && TREE_CODE (lhs) == SSA_NAME) { - tree sprime = substitute_and_fold_engine->value_of_expr (lhs, stmt); + tree sprime = substitute_and_fold_engine->value_of_stmt (stmt, lhs); if (sprime && sprime != lhs && may_propagate_copy (lhs, sprime) -- 2.17.2