From patchwork Mon Mar 13 15:53:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 66297 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D0D5C3858025 for ; Mon, 13 Mar 2023 15:54:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0D5C3858025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678722851; bh=h3Lq7fj7KRXjdI/FjswvTJS+xbvPlQrepNq+yflq3jE=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=BwE0gCgwLQ20KGgp8Znnjn6CbpS6+4hGjrp15EnMb2i9jbH5X2jvoKt43ND7Av5Vq gCWSk4rEaJc10LmNSFO1hoFsgEOoyokylV9RD2THZK4KaF+Y2l5B6+XTGIykyRsSjM 3TCaXAjYI7o+Zkx05syH7gIfvKEnbQjRw2kzSTyQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 643DA3858C00 for ; Mon, 13 Mar 2023 15:53:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 643DA3858C00 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A26FA2F4; Mon, 13 Mar 2023 08:54:21 -0700 (PDT) Received: from [10.57.79.198] (unknown [10.57.79.198]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6545C3F71A; Mon, 13 Mar 2023 08:53:37 -0700 (PDT) Message-ID: <716e6395-4108-0864-4272-f96b232989d2@arm.com> Date: Mon, 13 Mar 2023 15:53:30 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener Subject: [PATCH] ifcvt: Lower bitfields only if suitable for scalar register [PR tree/109005] X-Spam-Status: No, score=-15.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Andre Vieira \(lists\) via Gcc-patches" From: "Andre Vieira (lists)" Reply-To: "Andre Vieira \(lists\)" Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch fixes the condition check for eligilibity of lowering bitfields, where before we would check for non-BLKmode types, in the hope of excluding unsuitable aggregate types, we now check directly the representative is not an aggregate type, i.e. suitable for a scalar register. I tried adding the reduced testcase mentioned in the PR, but I couldn't get the Ada testsuite to run, so could an Ada maintainer add the test after verifying it runs properly? OK for trunk? gcc/ChangeLog: PR tree/109005 * tree-if-conv.cc (get_bitfield_rep): Replace BLKmode check with aggregate type check. diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc index f133102ad3350a0fd3a09ad836c68e840f316a0e..ca1abd8656c6c47c314d2b2c9fa515e150d1703b 100644 --- a/gcc/tree-if-conv.cc +++ b/gcc/tree-if-conv.cc @@ -3317,9 +3317,9 @@ get_bitfield_rep (gassign *stmt, bool write, tree *bitpos, tree field_decl = TREE_OPERAND (comp_ref, 1); tree rep_decl = DECL_BIT_FIELD_REPRESENTATIVE (field_decl); - /* Bail out if the representative is BLKmode as we will not be able to - vectorize this. */ - if (TYPE_MODE (TREE_TYPE (rep_decl)) == E_BLKmode) + /* Bail out if the representative is not a suitable type for a scalar + register variable. */ + if (!is_gimple_reg_type (TREE_TYPE (rep_decl))) return NULL_TREE; /* Bail out if the DECL_SIZE of the field_decl isn't the same as the BF's