From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 ABCDD3858C48 for ; Tue, 11 Jun 2024 12:47:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ABCDD3858C48 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 ABCDD3858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718110078; cv=none; b=N8OWCcMbuJt8heCk1csWFrOWD3831do+ZOEQqUzTEnKZFuGFoRlmO5vG9yxY9Io5nrzuIh/MyOXs8vJQ5zd+2OoNGSCLh0od53F74Etv4S+LN01Ph/XEPX9kRWX+1MB+H+OSeYIdYpD4qh2k8QTb/G8T12++0LQj/48V1LGdAk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718110078; c=relaxed/simple; bh=G9rpPQHoexkdkZ0cy/LCjKKh3DwxLDeSvMu+N/fXRlM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:Subject:To; b=MUCFib2zNlQRk2paHMc078F5Ya1Gr4Nq17yvgSZS9dtw/49CrUxiyE7zUXRkIn+uUZj9yb+jkks6/W8b42XKyAurNIAFsImh3ek7IB+Aqp/eDu1EARavf/P8JTPim2s+ZqWCqZ8CIc4JKW147UFTyuXQnc4oznm3ary0K0KPZSg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718110076; 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: in-reply-to:in-reply-to:references:references; bh=/EkKqbQ+e3YmWgiGUVrGlBBf0sa84JUseKxLBNkixlU=; b=azy5bWP1F7iuTE59AFgU41dtjU1tGoCH6rZLQvwYBBKcEcdHhPO8g+ith/NTLWyqKetIRa IWI3PSgqapY8YrcU0tqgDYvYDPoOhf9xFw8lu/rqiF/VNrfOYvl4EoH59WRujtgV8/pJao m0eqpeDd5IFr89/lBS8bOyzL02fo28E= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-524-haA2-1WROhOV6jx3PvK9aA-1; Tue, 11 Jun 2024 08:47:53 -0400 X-MC-Unique: haA2-1WROhOV6jx3PvK9aA-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6b07eccbaceso26086046d6.3 for ; Tue, 11 Jun 2024 05:47:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718110072; x=1718714872; h=in-reply-to:content-language:references:cc:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9CX8LQlvIsGYeKJ2qcT1g15INN9MkmemjzTDsN9Bl8c=; b=At9zekJkw//F8MqJRnGBske/rBul2VVhKkdbPpxWK+U2L6TWJc2u49vA2F7o91Fjca Vx2eptHhCD0xf6LHEKmFCvQhwuCbDxoZlZmWBFZntxNLCqjV9S/GCBTBC99LYmiiMYqW qrYSz0fmf3s+VRlGm/NUO098oE4Po451/kKPzbKrC/6g1cSZBx2qfK1ANJjDsI5C2n6c Dm9PzRMDsKxD3aiXQT7FPoW8HKuEKmURjAFH2wCVwiGR7KA89az+pvsC+eGNavVFztdQ Qg4DCJyILYZmgTqjH+fS99zkYIrKk6MSjvHMey+v+YMWCZ25mP9lATqJv2vU2HI0lPRQ eTyg== X-Gm-Message-State: AOJu0Yy0O0e0hdr9qzix/f8N5fSHjCNdm6AodMeOVESVjnjt1U2lpOvH N7SVz1YvDHWZ5Vhtqq5zpANeNQzfqy6LiXYQAEbs2lnldUcJD5RwRZ+Jk6ERLEIQIniXZIVLA1N ktmegIz7tvQxM8ZSrbdXTH6UbEZfssLx+aBQLuAXc700kNBJahce8LrQ= X-Received: by 2002:a05:6214:4386:b0:6b0:8618:b13f with SMTP id 6a1803df08f44-6b08618b1f3mr36216716d6.38.1718110072628; Tue, 11 Jun 2024 05:47:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIDdOblWrG8oAKiomHSO/rAUSKPP1m+dem7Fx6mGY/o03V+1EA+3t4bh6rLVQmwsGKkkFMWQ== X-Received: by 2002:a05:6214:4386:b0:6b0:8618:b13f with SMTP id 6a1803df08f44-6b08618b1f3mr36216496d6.38.1718110072188; Tue, 11 Jun 2024 05:47:52 -0700 (PDT) Received: from [192.168.0.174] ([104.219.120.74]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b04f9b1197sm56215876d6.103.2024.06.11.05.47.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jun 2024 05:47:51 -0700 (PDT) Message-ID: <539dd6c8-cd2c-4c9a-8417-2b7e9e9c2c9d@redhat.com> Date: Tue, 11 Jun 2024 08:47:50 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Andrew MacLeod Subject: Re: [COMMITTED] tree-optimization/115221 - Do not invoke SCEV if it will use a different range query. To: Richard Biener Cc: gcc-patches , "hernandez, aldy" References: <6614eff0-1c27-478f-9cab-baa726d1b91c@redhat.com> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="------------Vp2xdwKwguRzO7gviurrcls7" Content-Language: en-US X-Spam-Status: No, score=-11.7 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 List-Id: This is a multi-part message in MIME format. --------------Vp2xdwKwguRzO7gviurrcls7 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 5/29/24 03:19, Richard Biener wrote: > On Tue, May 28, 2024 at 8:57 PM Andrew MacLeod wrote: >> The original patch causing the PR made ranger's cache re-entrant to >> enable SCEV to use the current range_query when called from within ranger.. >> >> SCEV uses the currently active range query (via get_range_query()) for >> picking up values. fold_using_range is the general purpose stmt folder >> many components use, and it takes a range_query to use for folding. >> When propagating values in the cache, we need to ensure no new queries >> are invoked, and when the cache is propagating and calculating outgoing >> edges, it switches to a read only range_query which uses what it knows >> about global values to come up with best result using current state. >> >> SCEV is unaware of what the caller is using for a range_query, so when >> attempting to fold a PHI node, it is re-invoking the current query >> during propagation which is undesired behavior. This patch tells >> fold_using_range to not use SCEV if the range_query being used is not >> the same as the one SCEV is going to use. >> >> Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed. > Can we dump a hint to an active dump-file if this happens? I suppose it's > an unwanted situation, like the pass not setting the active ranger? Sth > like > > if (src.query () != get_range_query (cfun) > && dump_file) > fprintf (dump_file, "Using a range query different from the > installed one\n"); > > (or better wording). > > Btw, could we install src.query () as the global range query around the > relevant recursion or is the place around where we'd need to do this > not so clear-cut? > As requested, this patch will issues a message in the listing if we fail to execute SCEV under normal usage. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew --------------Vp2xdwKwguRzO7gviurrcls7 Content-Type: text/x-patch; charset=UTF-8; name="0001-scev-query-mismatch-message.patch" Content-Disposition: attachment; filename="0001-scev-query-mismatch-message.patch" Content-Transfer-Encoding: base64 RnJvbSAzYzRiMGIxNmJjYmM3MzF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