From patchwork Sat May 11 09:24:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1934089 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=Wj53UHa7; 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 4Vc0jB59p2z1yfq for ; Sat, 11 May 2024 19:25:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB6F5387087B for ; Sat, 11 May 2024 09:25:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) by sourceware.org (Postfix) with ESMTPS id 6C7423858D38 for ; Sat, 11 May 2024 09:25:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C7423858D38 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=localhost.redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6C7423858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.139.111.44 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715419513; cv=none; b=DvsKtT/umJUVikQOe9NL95AddUNxt8zjM+Gn17JnglOukVMJWTDFvmKiJ9Tkor6M4NbxM/NmvlsRAFPaYEiE5cq8teXmBQmWN2VE+3DyZJFto5q8829Wp2ABvp1kT3GXaeuKRMOLDQfEEO6DfGY3VcTWuJJ0skDUde9kUN8Wwhs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715419513; c=relaxed/simple; bh=2EUUBuR8I+ju65YduawmsBrG5hkCv9HuPKt2/PQZeUk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dM7QFkT66kN6S4qSASDNyAU2Wpm29/mr9MCDNSugdcj4HYo09R/diX/XryaReJJMSvp52G2i8zAvxYfKhPbCuS2Ev8kbGiyPCnrVRj3Urq2iiSueNIPHWdYa0KP+cmuwOnFenbinKgZJ20kwpkt97WICGyXUhZfYbXeEmWwnfts= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715419509; 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=XxjOH1AnArcXMLJF1GzPiRELM+Wo2BwB1zz4bj4DeUw=; b=Wj53UHa7aJNCjui4l4MpUUgVHTRnyZy48m0TmQTpgoJo57tuUConE95EJwM2LYvJtlnLjr Z4uGCgMU3WLWDgePy9NqYdUmah9C7Xp9X42R4jsoUNcMaKWCPE6dKU7u1vkIoxeRXo3b9J MxP/uTk1iDk9zXNHeDF1qcBPpOzN3XE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-k8fyqiw5MCqjrD4N7doGrQ-1; Sat, 11 May 2024 05:25:08 -0400 X-MC-Unique: k8fyqiw5MCqjrD4N7doGrQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01149185A780 for ; Sat, 11 May 2024 09:25:08 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD22644E3AF7; Sat, 11 May 2024 09:25:07 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.18.1/8.17.1) with ESMTPS id 44B9P6MC668119 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 11 May 2024 11:25:06 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.18.1/8.18.1/Submit) id 44B9P5SY668118; Sat, 11 May 2024 11:25:05 +0200 From: Aldy Hernandez To: GCC patches Cc: Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED] [prange] Do not trap by default on range dispatch mismatches. Date: Sat, 11 May 2024 11:24:57 +0200 Message-ID: <20240511092502.668080-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW, 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 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 trap in the range-op dispatch code is really an internal debugging aid, and only a temporary one for a few weeks while the dust settles. This patch turns it off by default, allowing problematic passes to turn it on for analysis. gcc/ChangeLog: * range-op.cc (TRAP_ON_UNHANDLED_POINTER_OPERATORS): New (range_op_handler::fold_range): Use it. (range_op_handler::op1_range): Same. (range_op_handler::op2_range): Same. (range_op_handler::lhs_op1_relation): Same. (range_op_handler::lhs_op2_relation): Same. (range_op_handler::op1_op2_relation): Same. --- gcc/range-op.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/gcc/range-op.cc b/gcc/range-op.cc index a134af68141..6a410ff656c 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -49,6 +49,11 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-ccp.h" #include "range-op-mixed.h" +// Set to 1 to trap on range-op entries that cannot handle the pointer +// combination being requested. This is a temporary sanity check to +// aid in debugging, and will be removed later in the release cycle. +#define TRAP_ON_UNHANDLED_POINTER_OPERATORS 0 + // Instantiate the operators which apply to multiple types here. operator_equal op_equal; @@ -233,7 +238,8 @@ range_op_handler::fold_range (vrange &r, tree type, #if CHECKING_P if (!lh.undefined_p () && !rh.undefined_p ()) gcc_assert (m_operator->operand_check_p (type, lh.type (), rh.type ())); - if (has_pointer_operand_p (r, lh, rh) + if (TRAP_ON_UNHANDLED_POINTER_OPERATORS + && has_pointer_operand_p (r, lh, rh) && !m_operator->pointers_handled_p (DISPATCH_FOLD_RANGE, dispatch_kind (r, lh, rh))) discriminator_fail (r, lh, rh); @@ -299,7 +305,8 @@ range_op_handler::op1_range (vrange &r, tree type, #if CHECKING_P if (!op2.undefined_p ()) gcc_assert (m_operator->operand_check_p (lhs.type (), type, op2.type ())); - if (has_pointer_operand_p (r, lhs, op2) + if (TRAP_ON_UNHANDLED_POINTER_OPERATORS + && has_pointer_operand_p (r, lhs, op2) && !m_operator->pointers_handled_p (DISPATCH_OP1_RANGE, dispatch_kind (r, lhs, op2))) discriminator_fail (r, lhs, op2); @@ -353,7 +360,8 @@ range_op_handler::op2_range (vrange &r, tree type, #if CHECKING_P if (!op1.undefined_p ()) gcc_assert (m_operator->operand_check_p (lhs.type (), op1.type (), type)); - if (has_pointer_operand_p (r, lhs, op1) + if (TRAP_ON_UNHANDLED_POINTER_OPERATORS + && has_pointer_operand_p (r, lhs, op1) && !m_operator->pointers_handled_p (DISPATCH_OP2_RANGE, dispatch_kind (r, lhs, op1))) discriminator_fail (r, lhs, op1); @@ -395,7 +403,8 @@ range_op_handler::lhs_op1_relation (const vrange &lhs, { gcc_checking_assert (m_operator); #if CHECKING_P - if (has_pointer_operand_p (lhs, op1, op2) + if (TRAP_ON_UNHANDLED_POINTER_OPERATORS + && has_pointer_operand_p (lhs, op1, op2) && !m_operator->pointers_handled_p (DISPATCH_LHS_OP1_RELATION, dispatch_kind (lhs, op1, op2))) discriminator_fail (lhs, op1, op2); @@ -442,7 +451,8 @@ range_op_handler::lhs_op2_relation (const vrange &lhs, { gcc_checking_assert (m_operator); #if CHECKING_P - if (has_pointer_operand_p (lhs, op1, op2) + if (TRAP_ON_UNHANDLED_POINTER_OPERATORS + && has_pointer_operand_p (lhs, op1, op2) && !m_operator->pointers_handled_p (DISPATCH_LHS_OP2_RELATION, dispatch_kind (lhs, op1, op2))) discriminator_fail (lhs, op1, op2); @@ -475,7 +485,8 @@ range_op_handler::op1_op2_relation (const vrange &lhs, { gcc_checking_assert (m_operator); #if CHECKING_P - if (has_pointer_operand_p (lhs, op1, op2) + if (TRAP_ON_UNHANDLED_POINTER_OPERATORS + && has_pointer_operand_p (lhs, op1, op2) && !m_operator->pointers_handled_p (DISPATCH_OP1_OP2_RELATION, dispatch_kind (lhs, op1, op2))) discriminator_fail (lhs, op1, op2);