From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 18C1B3858405 for ; Mon, 27 Sep 2021 13:04:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18C1B3858405 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EC59A1FE49 for ; Mon, 27 Sep 2021 13:04:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D946513A7F for ; Mon, 27 Sep 2021 13:04:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1Pv1M1DBUWFSfQAAMHmgww (envelope-from ) for ; Mon, 27 Sep 2021 13:04:16 +0000 Date: Mon, 27 Sep 2021 15:04:16 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] middle-end/102450 - avoid type_for_size for non-existing modes Message-ID: <92p5834s-q121-8n1-6o5s-91q4192o249p@fhfr.qr> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Mon, 27 Sep 2021 13:04:23 -0000 This avoids asking type_for_size for types with sizes for which no scalar integer mode exists. Instead the following uses int_mode_for_size to get the same result. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-09-27 Richard Biener PR middle-end/102450 * gimple-fold.c (gimple_fold_builtin_memory_op): Avoid using type_for_size, instead use int_mode_for_size. --- gcc/gimple-fold.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 6fea8a6f9fd..474d0f44375 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1001,9 +1001,7 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, return false; scalar_int_mode mode; - tree type = lang_hooks.types.type_for_size (ilen * 8, 1); - if (type - && is_a (TYPE_MODE (type), &mode) + if (int_mode_for_size (ilen * 8, 0).exists (&mode) && GET_MODE_SIZE (mode) * BITS_PER_UNIT == ilen * 8 && have_insn_for (SET, mode) /* If the destination pointer is not aligned we must be able @@ -1013,6 +1011,7 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, || (optab_handler (movmisalign_optab, mode) != CODE_FOR_nothing))) { + tree type = build_nonstandard_integer_type (ilen * 8, 1); tree srctype = type; tree desttype = type; if (src_align < GET_MODE_ALIGNMENT (mode)) -- 2.31.1