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 ESMTP id E7E273847810 for ; Fri, 21 May 2021 11:52:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E7E273847810 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-140-JW-0QjS3NPmxLhMNGOCyuQ-1; Fri, 21 May 2021 07:52:34 -0400 X-MC-Unique: JW-0QjS3NPmxLhMNGOCyuQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B4AF100945E; Fri, 21 May 2021 11:52:33 +0000 (UTC) Received: from abulafia.quesejoda.com (ovpn-113-127.ams2.redhat.com [10.36.113.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D616B5C1C4; Fri, 21 May 2021 11:52:32 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.16.1/8.15.2) with ESMTPS id 14LBqUle1148419 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 21 May 2021 13:52:31 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.16.1/8.16.1/Submit) id 14LBqUep1148418; Fri, 21 May 2021 13:52:30 +0200 From: Aldy Hernandez To: GCC patches , Andrew MacLeod Cc: Jeff Law , Martin Sebor , Aldy Hernandez Subject: [PATCH 2/5] Convert Walloca pass to RANGE_QUERY(cfun). Date: Fri, 21 May 2021 13:39:51 +0200 Message-Id: <20210521113954.1148075-2-aldyh@redhat.com> In-Reply-To: <20210521113954.1148075-1-aldyh@redhat.com> References: <20210521113954.1148075-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-13.3 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Fri, 21 May 2021 11:52:37 -0000 This patch converts the Walloca pass to use an on-demand ranger accesible with RANGE_QUERY instead of having to create a ranger and pass it around. Tested on x86-64 Linux. OK? gcc/ChangeLog: * gimple-ssa-warn-alloca.c (alloca_call_type): Use RANGE_QUERY instead of query argument. (pass_walloca::execute): Enable and disable global ranger. --- gcc/gimple-ssa-warn-alloca.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c index e9a24d4d1d0..12f4bce3be8 100644 --- a/gcc/gimple-ssa-warn-alloca.c +++ b/gcc/gimple-ssa-warn-alloca.c @@ -165,7 +165,7 @@ adjusted_warn_limit (bool idx) // call was created by the gimplifier for a VLA. static class alloca_type_and_limit -alloca_call_type (range_query &query, gimple *stmt, bool is_vla) +alloca_call_type (gimple *stmt, bool is_vla) { gcc_assert (gimple_alloca_call_p (stmt)); tree len = gimple_call_arg (stmt, 0); @@ -217,7 +217,7 @@ alloca_call_type (range_query &query, gimple *stmt, bool is_vla) int_range_max r; if (warn_limit_specified_p (is_vla) && TREE_CODE (len) == SSA_NAME - && query.range_of_expr (r, len, stmt) + && RANGE_QUERY (cfun)->range_of_expr (r, len, stmt) && !r.varying_p ()) { // The invalid bits are anything outside of [0, MAX_SIZE]. @@ -256,7 +256,7 @@ in_loop_p (gimple *stmt) unsigned int pass_walloca::execute (function *fun) { - gimple_ranger ranger; + enable_ranger (); basic_block bb; FOR_EACH_BB_FN (bb, fun) { @@ -290,7 +290,7 @@ pass_walloca::execute (function *fun) continue; class alloca_type_and_limit t - = alloca_call_type (ranger, stmt, is_vla); + = alloca_call_type (stmt, is_vla); unsigned HOST_WIDE_INT adjusted_alloca_limit = adjusted_warn_limit (false); @@ -383,6 +383,7 @@ pass_walloca::execute (function *fun) } } } + disable_ranger (); return 0; } -- 2.31.1