Message ID | ZWBdDpASQrBk+5+0@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp997089vqx; Fri, 24 Nov 2023 00:22:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEE9pxzYKZS061/PcJjR9djqS2X9kFN6lzpO8NWMfyemyXdLfTd2FxWJ8Z+/CScz+5+59cI X-Received: by 2002:ad4:48d4:0:b0:67a:1c3a:30ac with SMTP id v20-20020ad448d4000000b0067a1c3a30acmr339084qvx.47.1700814128467; Fri, 24 Nov 2023 00:22:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700814128; cv=pass; d=google.com; s=arc-20160816; b=byxQxZe0HDAo7BhyQul9eLtZa0EJKJN6o4dWm8xouSDOHUG2XURhSwSLMyPFCufUjh z8DsiiMQYYRt6URaDqus5ZKHncP/K1KBvLpd8Gr1xKiGbYffyyufHCW+t1uucbGyiXdj eTFgXMH88rysiNib58ci9RjNSUsSeV3BBx4YqpIPmhJ/xBdub8KtLYd+uIWd5KjqCgpZ lPVIQK8ZbvyWZ3X98M/VmPm7pzMtwLz96Dx16HCxmB8oSK7S45tXCT2VaBsxZnLWacuu SXsSujdMZKQYOwrY+lZzsxpomVJnn4MOzDjB2Z6EHFxa2nn3ELOCaDW2kwzBJj2TGly8 7tpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=t9Qkad/sjIrBH/i7IFMBvlBFAmjUG1Vt/KRGY0tjIV8=; fh=FCjeRajqaQYHMkQtfIia8KT5yBac53mYOLLyJhYG/AY=; b=fTNdWl27NasgxhjX3w1oPFRAqiiAh3Q3fuz2gPP9avi+sT1WGFfD1Spm/IoSZ9HT94 enA06G0ld8VGo5JZ5FRlTFDpQGTjsVvvYkNV7k1wI40MlYdRa8uZ2eaY2LdNfNxtbJY4 t/EHTgNCDuKg5kLP758JOV8FejhaAdtl4MmeyKNOcS6/J7kBPvG0GjPpa760NjXC4ks4 FoOn5pmSgPlmDSk+OIS2crfBEaEaWpngxJB7cS6PmsStis5ysu47g1WZCSzTNmaYtaro qWP2WcJrN+yZEpIBQYVTuC1q7RnZcih2BrQepGOhQG5upDGE/PVBhFnw+fZ7R5rZcsG5 TaHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O+tbCaA9; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id f16-20020a05620a12f000b0076d40ceedd8si2639328qkl.722.2023.11.24.00.22.08 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 00:22:08 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O+tbCaA9; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 33C0738582A6 for <ouuuleilei@gmail.com>; Fri, 24 Nov 2023 08:22:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 41D2C3858D33 for <gcc-patches@gcc.gnu.org>; Fri, 24 Nov 2023 08:21:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41D2C3858D33 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 41D2C3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700814104; cv=none; b=dyGm2sZ5uuOeAopMJdfdRcorSuYT+2YLJlsgSiql43GrO1oWhNbo1SZhSHXmnCoLV7tKbsdaFarCJkfgQvjsM/VEzRW2TPEqCKq8Qv2nr7dfM7PBp8FL19JGr5C7B5ClyZrsgtwhRWSr+ClcrhbdWpwLzyhqTfMGue8cAASZPzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700814104; c=relaxed/simple; bh=8cxEO0DAv+cAXLtIQmo5y9/x8Qfwi0EwzYN7EXqAX38=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=oFjZDX4Fe2y7yc3GeEAKFBFzgEVgsl35iLJWNKDZEVKWcazAF65TqyzX/njL/rVT/fhTZdMKpOO0H7t53gCuoHc1AnFN6CEwxctH3wXF875t9R80w9fPdx/Mk+/c8O7DhcFzYQLLTSy62oW6ceeLCKDZhjAp1qrMia4CdAD7AEk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700814101; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=t9Qkad/sjIrBH/i7IFMBvlBFAmjUG1Vt/KRGY0tjIV8=; b=O+tbCaA992QAErtTmqL4AOTWR/hLqVZsDUwN7JL6+K3+pY63T5bZ0bZ2q/RNYgk+IlTJQk +KzOZmEsqgjVk3bwcNts+G++6SWdsRU0EQAegEHwL8UI/JL8Yyq7OD5EDpyC+zWPOAY9z/ 0PpcMsqZGZoqxtBbymwMO+/4vv55VSk= 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-413-Qz9auL_2NHeQAVCUunNh0g-1; Fri, 24 Nov 2023 03:21:38 -0500 X-MC-Unique: Qz9auL_2NHeQAVCUunNh0g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 22B88828B25; Fri, 24 Nov 2023 08:21:38 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DABCB5028; Fri, 24 Nov 2023 08:21:37 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3AO8LZsv3449224 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 24 Nov 2023 09:21:35 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3AO8LYBB3449223; Fri, 24 Nov 2023 09:21:34 +0100 Date: Fri, 24 Nov 2023 09:21:34 +0100 From: Jakub Jelinek <jakub@redhat.com> To: Richard Biener <rguenther@suse.de> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] match.pd: Avoid simplification into invalid BIT_FIELD_REFs [PR112673] Message-ID: <ZWBdDpASQrBk+5+0@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783432875453219918 X-GMAIL-MSGID: 1783432875453219918 |
Series |
match.pd: Avoid simplification into invalid BIT_FIELD_REFs [PR112673]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Nov. 24, 2023, 8:21 a.m. UTC
Hi! The following testcase is lowered by the bitint lowering pass, then vectorizer vectorizes one of the loops in it, so we have vect__18.6_34 = VIEW_CONVERT_EXPR<vector(4) unsigned long>(x_35(D)); _8 = BIT_FIELD_REF <vect__18.6_34, 64, 0>; ... _18 = BIT_FIELD_REF <vect__18.6_34, 64, 64>; etc. where x_35(D) is _BitInt(256) argument. That is valid BIT_FIELD_REF, the first argument is a vector and it extracts the vector elements from it. Then comes forwprop4 and simplifies that using match.pd into _8 = (unsigned long) x_35(D); ... _18 = BIT_FIELD_REF <x_35(D), 64, 64>; and tree-cfg verification ICEs on the latter (though, even the first cast is kind of undesirable after bitint lowering, we want large/huge bitints lowered). The ICE is because if BIT_FIELD_REFs first argument has INTEGRAL_TYPE_P, we require type_has_mode_precision_p, but that is not the case of _BitInt(256), it has BLKmode. The following patch fixes it by doing the BIT_FIELD_REF with VCE to BIT_FIELD_REF simplification only if the result is valid. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-11-23 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/112673 * match.pd (bit_field_ref (vce @0) -> bit_field_ref @0): Only simplify if either @0 doesn't have scalar integral type or if it has mode precision. * gcc.dg/pr112673.c: New test. Jakub
--- gcc/match.pd.jj 2023-11-17 15:10:43.306043972 +0100 +++ gcc/match.pd 2023-11-23 18:09:22.538414897 +0100 @@ -8285,7 +8285,9 @@ (define_operator_list SYNC_FETCH_AND_AND (simplify (BIT_FIELD_REF (view_convert @0) @1 @2) - (BIT_FIELD_REF @0 @1 @2)) + (if (! INTEGRAL_TYPE_P (TREE_TYPE (@0)) + || type_has_mode_precision_p (TREE_TYPE (@0))) + (BIT_FIELD_REF @0 @1 @2))) (simplify (BIT_FIELD_REF @0 @1 integer_zerop) --- gcc/testsuite/gcc.dg/pr112673.c.jj 2023-11-23 18:29:44.540260525 +0100 +++ gcc/testsuite/gcc.dg/pr112673.c 2023-11-23 18:31:31.863765381 +0100 @@ -0,0 +1,10 @@ +/* PR tree-optimization/112673 */ +/* { dg-do compile { target bitint575 } } */ +/* { dg-options "-O3" } */ +/* { dg-additional-options "-mavx2" { target i?86-*-* x86_64-*-* } } */ + +int +foo (_BitInt(256) x) +{ + return __builtin_ctzg ((unsigned _BitInt(512)) x); +}