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 B90C23858D39 for ; Wed, 5 Oct 2022 00:24:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B90C23858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664929461; 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: content-transfer-encoding:content-transfer-encoding; bh=oGmtgWWnongsGM/EEslR6keCNkSWjF8ULq9oFATDTt4=; b=WCVSkSRhfC3mr7t34NmoC9N+pRg7UYpND9MlK7xHmBQi/jKJR1fRqQnJBVuWJxhcDdL1rL NmUOPVMUiPEIDbGCG4jxTwA/omvOWo1imbsxsKoa0qYAHiSWtCRWLxxO1hfscM9iqQmsb9 Ls7yPUiRfpcItPgA84MYJerOZlMTtvk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-346-860l3d_LNJe-WVMZMMutWg-1; Tue, 04 Oct 2022 20:24:20 -0400 X-MC-Unique: 860l3d_LNJe-WVMZMMutWg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A99D2999B4D for ; Wed, 5 Oct 2022 00:24:20 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.2.17.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14B5C40C206B; Wed, 5 Oct 2022 00:24:20 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [committed] analyzer: widening_svalues take a function_point rather than a program_point Date: Tue, 4 Oct 2022 20:24:18 -0400 Message-Id: <20221005002418.710712-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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,SPF_HELO_NONE,SPF_NONE,TXREP 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: Enabling work towrads better call summarization. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-3074-ge6fe02d8322093. gcc/analyzer/ChangeLog: * region-model-manager.cc (region_model_manager::get_or_create_widening_svalue): Use a function_point rather than a program_point. * region-model.cc (selftest::test_widening_constraints): Likewise. * region-model.h (region_model_manager::get_or_create_widening_svalue): Likewise. (model_merger::get_function_point): New. * svalue.cc (svalue::can_merge_p): Use a function_point rather than a program_point. (svalue::can_merge_p): Likewise. * svalue.h (widening_svalue::key_t): Likewise. (widening_svalue::widening_svalue): Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-manager.cc | 9 +++++---- gcc/analyzer/region-model.cc | 2 +- gcc/analyzer/region-model.h | 6 +++++- gcc/analyzer/svalue.cc | 4 ++-- gcc/analyzer/svalue.h | 8 ++++---- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc index cbda77f3d9c..ed5b9c75910 100644 --- a/gcc/analyzer/region-model-manager.cc +++ b/gcc/analyzer/region-model-manager.cc @@ -1143,10 +1143,11 @@ region_model_manager::get_or_create_unmergeable (const svalue *arg) and ITER_SVAL at POINT, creating it if necessary. */ const svalue * -region_model_manager::get_or_create_widening_svalue (tree type, - const program_point &point, - const svalue *base_sval, - const svalue *iter_sval) +region_model_manager:: +get_or_create_widening_svalue (tree type, + const function_point &point, + const svalue *base_sval, + const svalue *iter_sval) { gcc_assert (base_sval->get_kind () != SK_WIDENING); gcc_assert (iter_sval->get_kind () != SK_WIDENING); diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 22c52872c3e..e92bba2b438 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -7956,7 +7956,7 @@ static void test_widening_constraints () { region_model_manager mgr; - program_point point (program_point::origin (mgr)); + function_point point (program_point::origin (mgr).get_function_point ()); tree int_0 = build_int_cst (integer_type_node, 0); tree int_m1 = build_int_cst (integer_type_node, -1); tree int_1 = build_int_cst (integer_type_node, 1); diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h index e86720a645c..baac7ba4a12 100644 --- a/gcc/analyzer/region-model.h +++ b/gcc/analyzer/region-model.h @@ -278,7 +278,7 @@ public: const svalue *inner_svalue); const svalue *get_or_create_unmergeable (const svalue *arg); const svalue *get_or_create_widening_svalue (tree type, - const program_point &point, + const function_point &point, const svalue *base_svalue, const svalue *iter_svalue); const svalue *get_or_create_compound_svalue (tree type, @@ -1282,6 +1282,10 @@ struct model_merger } bool mergeable_svalue_p (const svalue *) const; + const function_point &get_function_point () const + { + return m_point.get_function_point (); + } const region_model *m_model_a; const region_model *m_model_b; diff --git a/gcc/analyzer/svalue.cc b/gcc/analyzer/svalue.cc index f5a5f1c9697..a37c152bb04 100644 --- a/gcc/analyzer/svalue.cc +++ b/gcc/analyzer/svalue.cc @@ -207,7 +207,7 @@ svalue::can_merge_p (const svalue *other, if (maybe_get_constant () && other->maybe_get_constant ()) { return mgr->get_or_create_widening_svalue (other->get_type (), - merger->m_point, + merger->get_function_point (), other, this); } @@ -220,7 +220,7 @@ svalue::can_merge_p (const svalue *other, && binop_sval->get_arg1 ()->get_kind () == SK_CONSTANT && other->get_kind () != SK_WIDENING) return mgr->get_or_create_widening_svalue (other->get_type (), - merger->m_point, + merger->get_function_point (), other, this); /* Merge: (Widen(existing_val, V), existing_val) -> Widen (existing_val, V) diff --git a/gcc/analyzer/svalue.h b/gcc/analyzer/svalue.h index f4cab0d4134..9393d6ec213 100644 --- a/gcc/analyzer/svalue.h +++ b/gcc/analyzer/svalue.h @@ -1113,9 +1113,9 @@ public: /* A support class for uniquifying instances of widening_svalue. */ struct key_t { - key_t (tree type, const program_point &point, + key_t (tree type, const function_point &point, const svalue *base_sval, const svalue *iter_sval) - : m_type (type), m_point (point.get_function_point ()), + : m_type (type), m_point (point), m_base_sval (base_sval), m_iter_sval (iter_sval) {} @@ -1153,12 +1153,12 @@ public: DIR_UNKNOWN }; - widening_svalue (tree type, const program_point &point, + widening_svalue (tree type, const function_point &point, const svalue *base_sval, const svalue *iter_sval) : svalue (complexity::from_pair (base_sval->get_complexity (), iter_sval->get_complexity ()), type), - m_point (point.get_function_point ()), + m_point (point), m_base_sval (base_sval), m_iter_sval (iter_sval) { gcc_assert (base_sval->can_have_associated_state_p ()); -- 2.26.3