From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id B6EE23857417 for ; Fri, 28 Oct 2022 13:06:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6EE23857417 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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-out1.suse.de (Postfix) with ESMTPS id 9035721AC4 for ; Fri, 28 Oct 2022 13:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1666962389; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=mSVMsaj6JRv255TGuvujSyd/BXFFkGPQpjM24jEIwh0=; b=cFTV4+6axOkFq40pnWTItB/vmCq9mCTwf9sqhDbTB0n0rKtXUwPi/TFPfA3B0D1GOrjJfW eQFZua6F+37N5+sr08eoKMQlG4nYClmNhWJB8qQ9baxgy+oSMdK6IZe2p9aSgLCiYzpQTS 6Kdkd0v+KAaJueqeq3pC9dWWa4/8XOA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1666962389; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=mSVMsaj6JRv255TGuvujSyd/BXFFkGPQpjM24jEIwh0=; b=LGSNqeKxjPChNyR+Id6zMEepKDJrB5csXvbw2yfByQ351pDKDW3iOep/ZH0+hHm7Qxq7O1 FJuM4uMsfdnbeHAQ== 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 7CEC513A6E for ; Fri, 28 Oct 2022 13:06:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 34BgHdXTW2MZCgAAMHmgww (envelope-from ) for ; Fri, 28 Oct 2022 13:06:29 +0000 Date: Fri, 28 Oct 2022 15:06:29 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/107435 - ICE with recurrence vectorization MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Message-Id: <20221028130629.7CEC513A6E@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This implements the missed conversion from pointer to integer. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/107435 * tree-vect-loop.cc (vectorizable_recurr): Convert initial value to vector component type. * gcc.dg/torture/pr107435.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr107435.c | 23 +++++++++++++++++++++++ gcc/tree-vect-loop.cc | 6 ++++++ 2 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr107435.c diff --git a/gcc/testsuite/gcc.dg/torture/pr107435.c b/gcc/testsuite/gcc.dg/torture/pr107435.c new file mode 100644 index 00000000000..10128969191 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr107435.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */ + +struct qlist_head { + struct qlist_head *next; +}; +void +qlist_add (struct qlist_head *new, struct qlist_head *head) +{ + struct qlist_head *prev = head; + new->next = head->next; + prev->next = new; +} +struct { + struct qlist_head queue_link; +} free_list, prealloc[64]; +void +dbpf_open_cache_initialize() +{ + int i = 0; + for (; i < 64; i++) + qlist_add(&prealloc[i].queue_link, &free_list.queue_link); +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index d5c2bff80be..aacbb12580c 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -8469,6 +8469,12 @@ vectorizable_recurr (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, edge pe = loop_preheader_edge (LOOP_VINFO_LOOP (loop_vinfo)); basic_block bb = gimple_bb (phi); tree preheader = PHI_ARG_DEF_FROM_EDGE (phi, pe); + if (!useless_type_conversion_p (TREE_TYPE (vectype), TREE_TYPE (preheader))) + { + gimple_seq stmts = NULL; + preheader = gimple_convert (&stmts, TREE_TYPE (vectype), preheader); + gsi_insert_seq_on_edge_immediate (pe, stmts); + } tree vec_init = build_vector_from_val (vectype, preheader); vec_init = vect_init_vector (loop_vinfo, stmt_info, vec_init, vectype, NULL); -- 2.35.3