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 C1EF53858D33 for ; Mon, 17 Jul 2023 13:14:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C1EF53858D33 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=1689599658; 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=rRXExWCa6yj3paCO15I0HXfVclQybkJALowBj8Vjc1s=; b=OihpTjfIKHRuXiBZEnxtLVL2c65MTzI57bBWweFwZeg2FRSRcdPRIHT707EomuQCRbIuSR cQ7udB/YZBgI3zRaxZCxyJSYWpDNhwb3sK0D7U95verroXMIhRnYUIoiHkM2RUaH3jSDe4 YRneYyx+NiaEdPOQTPGSYUNdXFj4qZQ= Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-596-lAmn93ZONje-Z7WE1pZTlA-1; Mon, 17 Jul 2023 09:14:16 -0400 X-MC-Unique: lAmn93ZONje-Z7WE1pZTlA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 102F62A59579; Mon, 17 Jul 2023 13:14:16 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.194.204]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBBD510E62; Mon, 17 Jul 2023 13:14:15 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 36HDEDG5330666 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 17 Jul 2023 15:14:13 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 36HDEDo7330665; Mon, 17 Jul 2023 15:14:13 +0200 From: Aldy Hernandez To: GCC patches Cc: Andrew MacLeod , Martin Jambor , Aldy Hernandez Subject: [PATCH] Read global value/mask in IPA. Date: Mon, 17 Jul 2023 15:14:11 +0200 Message-Id: <20230717131411.330650-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=-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: Instead of reading the known zero bits in IPA, read the value/mask pair which is available. There is a slight change of behavior here. I have removed the check for SSA_NAME, as the ranger can calculate the range and value/mask for INTEGER_CST. This simplifies the code a bit, since there's no special casing when setting the jfunc bits. The default range for VR is undefined, so I think it's safe just to check for undefined_p(). OK? gcc/ChangeLog: * ipa-prop.cc (ipa_compute_jump_functions_for_edge): Read global value/mask. --- gcc/ipa-prop.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc index 5d790ff1265..4f6ed7b89bd 100644 --- a/gcc/ipa-prop.cc +++ b/gcc/ipa-prop.cc @@ -2402,8 +2402,7 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi, } else { - if (TREE_CODE (arg) == SSA_NAME - && param_type + if (param_type && Value_Range::supports_type_p (TREE_TYPE (arg)) && Value_Range::supports_type_p (param_type) && irange::supports_p (TREE_TYPE (arg)) @@ -2422,15 +2421,14 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi, gcc_assert (!jfunc->m_vr); } - if (INTEGRAL_TYPE_P (TREE_TYPE (arg)) - && (TREE_CODE (arg) == SSA_NAME || TREE_CODE (arg) == INTEGER_CST)) + if (INTEGRAL_TYPE_P (TREE_TYPE (arg)) && !vr.undefined_p ()) { - if (TREE_CODE (arg) == SSA_NAME) - ipa_set_jfunc_bits (jfunc, 0, - widest_int::from (get_nonzero_bits (arg), - TYPE_SIGN (TREE_TYPE (arg)))); - else - ipa_set_jfunc_bits (jfunc, wi::to_widest (arg), 0); + irange &r = as_a (vr); + irange_bitmask bm = r.get_bitmask (); + signop sign = TYPE_SIGN (TREE_TYPE (arg)); + ipa_set_jfunc_bits (jfunc, + widest_int::from (bm.value (), sign), + widest_int::from (bm.mask (), sign)); } else if (POINTER_TYPE_P (TREE_TYPE (arg))) { -- 2.40.1