From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 50C3738582A7 for ; Mon, 4 Jul 2022 12:57:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 50C3738582A7 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 27ABD22485; Mon, 4 Jul 2022 12:57:46 +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 101C81342C; Mon, 4 Jul 2022 12:57:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VZVQAsrjwmJhOAAAMHmgww (envelope-from ); Mon, 04 Jul 2022 12:57:46 +0000 Date: Mon, 4 Jul 2022 14:57:45 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: richard.sandiford@arm.com Subject: [PATCH] Revert update-ssa assert in vectorizer MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Message-Id: <20220704125746.101C81342C@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, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2022 12:57:48 -0000 The following reverts the just added assert that virtual SSA does not need updating. It instead goes for a select whitelist of transforms known to be prone to difficulties with virtual SSA update. Bootstrapped and tested on x86_64-unknown-linux-gnu, tested on aarch64 on the vect.exp testsuite showing all ICEs gone, pushed. * tree-vect-loop-manip.cc (vect_do_peeling): Revert assert and update virtual SSA form again. Assert we do so for a known set of transforms only. * tree-vectorizer.h (vec_info::any_known_not_updated_vssa): New. * tree-vect-stmts.cc (vectorizable_load): When vectorizing using load-lanes allow virtual SSA update. --- gcc/tree-vect-loop-manip.cc | 11 ++++++----- gcc/tree-vect-stmts.cc | 3 +++ gcc/tree-vectorizer.h | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 7b7af944dba..5c31f0a8091 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -2683,11 +2683,12 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, class loop *first_loop = loop; bool irred_flag = loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP; - /* Historically we might have a queued need to update virtual SSA form. - As we delete the update SSA machinery below after doing a regular - incremental SSA update during loop copying make sure we don't - lose that fact. */ - gcc_assert (!need_ssa_update_p (cfun)); + /* We should not have to update virtual SSA form here but some + transforms involve creating new virtual definitions which makes + updating difficult. */ + gcc_assert (!need_ssa_update_p (cfun) + || loop_vinfo->any_known_not_updated_vssa); + update_ssa (TODO_update_ssa_only_virtuals); create_lcssa_for_virtual_phi (loop); diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index d6a6fe3fb38..72107afc883 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -8979,6 +8979,9 @@ vectorizable_load (vec_info *vinfo, dump_printf_loc (MSG_NOTE, vect_location, "Vectorizing an unaligned access.\n"); + if (memory_access_type == VMAT_LOAD_STORE_LANES) + vinfo->any_known_not_updated_vssa = true; + STMT_VINFO_TYPE (stmt_info) = load_vec_info_type; vect_model_load_cost (vinfo, stmt_info, ncopies, vf, memory_access_type, alignment_support_scheme, misalignment, diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 642eb0aeb21..e5fdc9e0a14 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -444,6 +444,10 @@ public: /* Whether the above mapping is complete. */ bool stmt_vec_info_ro; + /* Whether we've done a transform we think OK to not update virtual + SSA form. */ + bool any_known_not_updated_vssa; + /* The SLP graph. */ auto_vec slp_instances; -- 2.35.3