From patchwork Fri Jun 14 19:20:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1948122 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CpRW3NV4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W18JW46MMz20Pb for ; Sat, 15 Jun 2024 05:20:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D491C388267C for ; Fri, 14 Jun 2024 19:20:57 +0000 (GMT) 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 35777388265E for ; Fri, 14 Jun 2024 19:20:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 35777388265E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 35777388265E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718392837; cv=none; b=JL5beB5QCu4JJJUhiTku2viEDC1xAJfUjK7goy9Q8w6TY5yDbsq5jcIAwZsXL5Og5NwxpPDToYxsmSZtnnn0WxcP6MnFhXem9fSiP2+8VRnHii7MjsArgcDWnHhF4DmzgO7AlkmRRpns4LINTPUr4tihoai/vmGEFO4+W5Yzf4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718392837; c=relaxed/simple; bh=4BqBKYaDWYnQVPtTxun5qh1rXvMm2Aogz5aHb9pNiw8=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=oQxmqnbnaNs+CEqspGMhgNqugUM8YDuA9/6RfGkCZ5/yW3u80T6wL+vARhZHMo6Wihx+NJ4/+EFNvRuhMsyqIvJOsZkMgIWKboHy3hTTJZfM6g4moTQtNs3D+Lm4l6pTXEXnQsaf7cDFERX6TwEnwymK4JRpyElEd8njvPTVLWA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718392834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=pX+gEZcSMOx5bObKk7x/ChylCQs6esEd1r2quYkR4ss=; b=CpRW3NV4opIuFI/17/iFrlao1K83pqO+M7dR3HGbQl5rnyP1ZzisiCvw68eRBvD+FcmeIC 7L2xIyiuuE4jCjHQCBnZH7/wg3KrMdqYn2a+5PZO7wfqM8MQ/YIoW3AL63NNrRPdXsAiOo 36ZI8LNirPHj+f9kyjVlRNNcK8ZilJY= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-rxLDRe4ENFqG11xPyPoQvQ-1; Fri, 14 Jun 2024 15:20:33 -0400 X-MC-Unique: rxLDRe4ENFqG11xPyPoQvQ-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4404a08e4d0so40927431cf.1 for ; Fri, 14 Jun 2024 12:20:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718392832; x=1718997632; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b5Lntyo8KmBIiyc4xdVTNxt8aVjcr2xlptj9bHSmejo=; b=p9SDBIKvv5Tx2vR/XMrnfR3cBe23PvfshkhKxWRHNnSe62+Z3SNYekKk/6ZIDm2IJM 3Cty/v5RXlLHrxaM9W7cJ3m18iW2gy3/x7GwKvggnbTnY9OQ7fKMcAudWL1q3/o6Pe+C G7tAd0WmKxgAvg4FR3Wgyq/oGH66mMkFqrmgC+KSUAL6tlHD9UAR0E23Gzkb8I3w//vC 5s/9QuZunBHrYJA7vR3vfOz1YLIRvG0WOR5btl/eEDDnXayVpVCp9N7CCGDTMB5+d2ww 8SaWdGJxelkilXRrYnCcgVEgIjyNHUzKrmhrUnboSElJjUp2UERdlO1cAp+HHk1es2p3 cYeQ== X-Gm-Message-State: AOJu0YyVvKFx5kfgiAHEqevL0CGpsRQEka5eVAY2E6AZuHO2iDcKDPKf QnFHpKcQO3Fm50AH7BYj9B5y7cCnyuVUbd2rYLcNrtIUF7PNa0hws4GUjajKSbkhBn5JMG16nXO HOAxaUzS5fzaMrrvuAANbsMg43MD8VlPaxppKtUrrReLHWoXyazg4LXAkDJ8i/s7e0h9QJ6ykXv 5A2kt/Y0wu9r5R24CH69UjjBHVxYWseM9dgJI6cDg= X-Received: by 2002:a05:622a:1791:b0:440:5476:55a9 with SMTP id d75a77b69052e-4421609bc3emr66114521cf.23.1718392832607; Fri, 14 Jun 2024 12:20:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IES7r01zmQNEYxW++iTbAycVOwKVukDfu6e1yVxlhFScH/4Cm69cMH9uaURu1pooX4QN4Znlg== X-Received: by 2002:a05:622a:1791:b0:440:5476:55a9 with SMTP id d75a77b69052e-4421609bc3emr66113971cf.23.1718392831933; Fri, 14 Jun 2024 12:20:31 -0700 (PDT) Received: from [192.168.0.174] ([104.219.120.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-441ef4de0ecsm19303431cf.9.2024.06.14.12.20.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jun 2024 12:20:31 -0700 (PDT) Message-ID: <57f13fee-e47c-4fdd-a7ab-06148e286dee@redhat.com> Date: Fri, 14 Jun 2024 15:20:29 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: gcc-patches Cc: "hernandez, aldy" From: Andrew MacLeod Subject: [COMMITTED] Dont add varying values to gori_on_edge mass, calculations. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-12.0 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_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org The 'gori_on_edge' routine is an API which provides all contextual names that can be calculated on an outgoing edge at once.   It provides this via the ssa_lazy_cache object. This patch recognizes that if the value produces VARYING, we should not put it in the list, nor continue processing the dependency chain. Bootstraps on  x86_64-pc-linux-gnu with no regressions.   Pushed. Andrew From 2f90cb8b36affbb28dba643dd38068fc88c76e12 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Fri, 14 Jun 2024 11:01:08 -0400 Subject: [PATCH 3/7] Dont add varying values to gori_on_edge mass calculations. gori_on_edge will return an ssa_lazy_cache with all contextual ranges that can be generated by an edge. This patch adjusts it so that a VARYING range is never added. * gimple-range-gori.cc (gori_calc_operands): Do not continue nor add the range when VARYING is produced for an operand. --- gcc/gimple-range-gori.cc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc index d489aef312c..4f6073c715a 100644 --- a/gcc/gimple-range-gori.cc +++ b/gcc/gimple-range-gori.cc @@ -1605,11 +1605,14 @@ gori_calc_operands (vrange &lhs, gimple *stmt, ssa_cache &r, range_query *q) tmp.set_type (TREE_TYPE (si.ssa1)); if (si.calc_op1 (tmp, lhs, si.op2_range)) si.op1_range.intersect (tmp); - r.set_range (si.ssa1, si.op1_range); - gimple *src = SSA_NAME_DEF_STMT (si.ssa1); - // If defintion is in the same basic lock, evaluate it. - if (src && gimple_bb (src) == gimple_bb (stmt)) - gori_calc_operands (si.op1_range, src, r, q); + if (!si.op1_range.varying_p ()) + { + r.set_range (si.ssa1, si.op1_range); + gimple *src = SSA_NAME_DEF_STMT (si.ssa1); + // If defintion is in the same basic lock, evaluate it. + if (src && gimple_bb (src) == gimple_bb (stmt)) + gori_calc_operands (si.op1_range, src, r, q); + } } if (si.ssa2 && !r.has_range (si.ssa2)) @@ -1617,10 +1620,13 @@ gori_calc_operands (vrange &lhs, gimple *stmt, ssa_cache &r, range_query *q) tmp.set_type (TREE_TYPE (si.ssa2)); if (si.calc_op2 (tmp, lhs, si.op1_range)) si.op2_range.intersect (tmp); - r.set_range (si.ssa2, si.op2_range); - gimple *src = SSA_NAME_DEF_STMT (si.ssa2); - if (src && gimple_bb (src) == gimple_bb (stmt)) - gori_calc_operands (si.op2_range, src, r, q); + if (!si.op2_range.varying_p ()) + { + r.set_range (si.ssa2, si.op2_range); + gimple *src = SSA_NAME_DEF_STMT (si.ssa2); + if (src && gimple_bb (src) == gimple_bb (stmt)) + gori_calc_operands (si.op2_range, src, r, q); + } } } -- 2.45.0