Message ID | 20221122084850.B6CA313B01@imap2.suse-dmz.suse.de |
---|---|
State | Committed |
Commit | 09b7993ab6d93716f77c03ff9a9165fa4b579f0d |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> 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 2ABA63858296 for <patchwork@sourceware.org>; Tue, 22 Nov 2022 08:49:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2ABA63858296 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669106965; bh=GHcZqIXOhyM5pXqNlF4VoQ9U2GHbxFbxjAd/MKjqpZY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=oIOgJsi37ErwAJlfZ6bGkT53HMSTIxc1c85ehquAqzzwqde+wDh3MctDl1XU98yGb ZhCUo6uygiCYK2ufP5hUxYeyjVPRVW2eL38plrdqhZ5K7URuZ+Pp1fgct8QkWfCZMK 5GXlOB0SPLdPV92DiL8RKlyelTOqsIhjXBMxNMrE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id C4C0B3858C20 for <gcc-patches@gcc.gnu.org>; Tue, 22 Nov 2022 08:48:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C4C0B3858C20 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 CB32E1F86B for <gcc-patches@gcc.gnu.org>; Tue, 22 Nov 2022 08:48:50 +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 B6CA313B01 for <gcc-patches@gcc.gnu.org>; Tue, 22 Nov 2022 08:48:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id r3ZrK/KMfGOZJQAAMHmgww (envelope-from <rguenther@suse.de>) for <gcc-patches@gcc.gnu.org>; Tue, 22 Nov 2022 08:48:50 +0000 Date: Tue, 22 Nov 2022 09:48:50 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/107672 - avoid vector mode type_for_mode call MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Message-Id: <20221122084850.B6CA313B01@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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 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> From: Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Richard Biener <rguenther@suse.de> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
tree-optimization/107672 - avoid vector mode type_for_mode call
|
|
Commit Message
Richard Biener
Nov. 22, 2022, 8:48 a.m. UTC
The following avoids using type_for_mode on vector modes which might not work for all frontends. Instead we look for the inner mode type and use build_vector_type_for_mode instead. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/107672 * tree-vect-stmts.cc (supportable_widening_operation): Avoid type_for_mode on vector modes. --- gcc/tree-vect-stmts.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
Comments
Hi, I am seeing an internal compiler error, related to this patch: during GIMPLE pass: slp options-save.cc: In function 'void cl_optimization_restore(gcc_options*, gcc_options*, cl_optimization*)': options-save.cc:1292:1: internal compiler error: in supportable_widening_operation, at tree-vect-stmts.cc:12199 1292 | cl_optimization_restore (struct gcc_options *opts, struct gcc_options *opts_set, | ^~~~~~~~~~~~~~~~~~~~~~~ /…/src/gcc/gcc/profile-count.cc: In member function 'int profile_count::to_cgraph_frequency(profile_count) const': /…/src/gcc/gcc/profile-count.cc:308:1: note: parameter passing for argument of type 'profile_count' changed in GCC 9.1 308 | profile_count::to_cgraph_frequency (profile_count entry_bb_count) const | ^~~~~~~~~~~~~ /…/src/gcc/gcc/profile-count.cc: In member function 'sreal profile_count::to_sreal_scale(profile_count, bool*) const': /…/src/gcc/gcc/profile-count.cc:326:1: note: parameter passing for argument of type 'profile_count' changed in GCC 9.1 326 | profile_count::to_sreal_scale (profile_count in, bool *known) const | ^~~~~~~~~~~~~ 0x2195bdd supportable_widening_operation(vec_info*, tree_code, _stmt_vec_info*, tree_node*, tree_node*, tree_code*, tree_code*, int*, vec<tree_node*, va_heap, vl_ptr>*) /…/src/gcc/gcc/tree-vect-stmts.cc:12199 0x2180493 vectorizable_conversion /…/src/gcc/gcc/tree-vect-stmts.cc:5064 0x2192fdd vect_analyze_stmt(vec_info*, _stmt_vec_info*, bool*, _slp_tree*, _slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*) /…/src/gcc/gcc/tree-vect-stmts.cc:11256 /…/src/gcc/gcc/profile-count.cc: In member function 'profile_count profile_count::combine_with_ipa_count(profile_count)': /…/src/gcc/gcc/profile-count.cc:398:1: note: parameter passing for argument of type 'profile_count' changed in GCC 9.1 398 | profile_count::combine_with_ipa_count (profile_count ipa) | ^~~~~~~~~~~~~ 0x14f95d1 vect_slp_analyze_node_operations_1 /…/src/gcc/gcc/tree-vect-slp.cc:5958 0x14f9c19 vect_slp_analyze_node_operations /…/src/gcc/gcc/tree-vect-slp.cc:6147 0x14f9b4d vect_slp_analyze_node_operations /…/src/gcc/gcc/tree-vect-slp.cc:6126 0x14fa439 vect_slp_analyze_operations(vec_info*) /…/src/gcc/gcc/tree-vect-slp.cc:6387 0x14fd423 vect_slp_analyze_bb_1 /…/src/gcc/gcc/tree-vect-slp.cc:7372 0x14fd599 vect_slp_region /…/src/gcc/gcc/tree-vect-slp.cc:7419 0x14fe0d1 vect_slp_bbs /…/src/gcc/gcc/tree-vect-slp.cc:7610 0x14fe46f vect_slp_function(function*) /…/src/gcc/gcc/tree-vect-slp.cc:7698 0x151a109 execute /…/src/gcc/gcc/tree-vectorizer.cc:1532 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Makefile:1146: recipe for target 'options-save.o' failed make[3]: *** [options-save.o] Error 1 That happens when building the arm-none-linux-gnueabihf toolchain natively with glibc bootstrap: Build:arm-none-linux-gnueabihf Host:arm-none-linux-gnueabihf Target: arm-none-linux-gnueabihf The compiler being used to build the toolchain is gcc 7.5.0. Kind regards Vasee
On Fri, 25 Nov 2022, Vaseeharan Vinayagamoorthy wrote: > Hi, > > I am seeing an internal compiler error, related to this patch: Can you please open a bugzilla for this and attach preprocessed source so I can reproduce the ICE with a cc1 cross compiler? Thanks, Richard. > > during GIMPLE pass: slp > > options-save.cc: In function 'void cl_optimization_restore(gcc_options*, > gcc_options*, cl_optimization*)': > > options-save.cc:1292:1: internal compiler error: in > supportable_widening_operation, at tree-vect-stmts.cc:12199 > > > > 1292 | cl_optimization_restore (struct gcc_options *opts, struct > gcc_options *opts_set, > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > /…/src/gcc/gcc/profile-count.cc: In member function 'int > profile_count::to_cgraph_frequency(profile_count) const': > > /…/src/gcc/gcc/profile-count.cc:308:1: note: parameter passing for argument > of type 'profile_count' changed in GCC 9.1 > > 308 | profile_count::to_cgraph_frequency (profile_count entry_bb_count) > const > > | ^~~~~~~~~~~~~ > > /…/src/gcc/gcc/profile-count.cc: In member function 'sreal > profile_count::to_sreal_scale(profile_count, bool*) const': > > /…/src/gcc/gcc/profile-count.cc:326:1: note: parameter passing for argument > of type 'profile_count' changed in GCC 9.1 > > 326 | profile_count::to_sreal_scale (profile_count in, bool *known) const > > | ^~~~~~~~~~~~~ > > 0x2195bdd supportable_widening_operation(vec_info*, tree_code, > _stmt_vec_info*, tree_node*, tree_node*, tree_code*, tree_code*, int*, > vec<tree_node*, va_heap, vl_ptr>*) > > /…/src/gcc/gcc/tree-vect-stmts.cc:12199 > > 0x2180493 vectorizable_conversion > > /…/src/gcc/gcc/tree-vect-stmts.cc:5064 > > 0x2192fdd vect_analyze_stmt(vec_info*, _stmt_vec_info*, bool*, _slp_tree*, > _slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*) > > /…/src/gcc/gcc/tree-vect-stmts.cc:11256 > > > > /…/src/gcc/gcc/profile-count.cc: In member function 'profile_count > profile_count::combine_with_ipa_count(profile_count)': > > /…/src/gcc/gcc/profile-count.cc:398:1: note: parameter passing for argument > of type 'profile_count' changed in GCC 9.1 > > 398 | profile_count::combine_with_ipa_count (profile_count ipa) > > | ^~~~~~~~~~~~~ > > 0x14f95d1 vect_slp_analyze_node_operations_1 > > /…/src/gcc/gcc/tree-vect-slp.cc:5958 > > 0x14f9c19 vect_slp_analyze_node_operations > > /…/src/gcc/gcc/tree-vect-slp.cc:6147 > > 0x14f9b4d vect_slp_analyze_node_operations > > /…/src/gcc/gcc/tree-vect-slp.cc:6126 > > 0x14fa439 vect_slp_analyze_operations(vec_info*) > > /…/src/gcc/gcc/tree-vect-slp.cc:6387 > > 0x14fd423 vect_slp_analyze_bb_1 > > /…/src/gcc/gcc/tree-vect-slp.cc:7372 > > 0x14fd599 vect_slp_region > > /…/src/gcc/gcc/tree-vect-slp.cc:7419 > > 0x14fe0d1 vect_slp_bbs > > /…/src/gcc/gcc/tree-vect-slp.cc:7610 > > 0x14fe46f vect_slp_function(function*) > > /…/src/gcc/gcc/tree-vect-slp.cc:7698 > > 0x151a109 execute > > /…/src/gcc/gcc/tree-vectorizer.cc:1532 > > Please submit a full bug report, with preprocessed source (by using > -freport-bug). > > Please include the complete backtrace with any bug report. > > See <https://gcc.gnu.org/bugs/> for instructions. > > Makefile:1146: recipe for target 'options-save.o' failed > > make[3]: *** [options-save.o] Error 1 > > > > That happens when building the arm-none-linux-gnueabihf toolchain natively > with glibc bootstrap: > Build:arm-none-linux-gnueabihf > Host:arm-none-linux-gnueabihf > Target: arm-none-linux-gnueabihf > > The compiler being used to build the toolchain is gcc 7.5.0. > > > Kind regards > Vasee > > ____________________________________________________________________________ > From: Gcc-patches <gcc-patches-bounces+vvinayag=arm.com@gcc.gnu.org> on > behalf of Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> > Sent: 22 November 2022 08:48 > To: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org> > Subject: [PATCH] tree-optimization/107672 - avoid vector mode type_for_mode > call > The following avoids using type_for_mode on vector modes which might > not work for all frontends. Instead we look for the inner mode > type and use build_vector_type_for_mode instead. > > Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. > > PR tree-optimization/107672 > * tree-vect-stmts.cc (supportable_widening_operation): Avoid > type_for_mode on vector modes. > --- > gcc/tree-vect-stmts.cc | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc > index bc0ef136f19..b35b986889d 100644 > --- a/gcc/tree-vect-stmts.cc > +++ b/gcc/tree-vect-stmts.cc > @@ -12195,9 +12195,15 @@ supportable_widening_operation (vec_info *vinfo, > intermediate_type > = vect_halve_mask_nunits (prev_type, intermediate_mode); > else > - intermediate_type > - = lang_hooks.types.type_for_mode (intermediate_mode, > - TYPE_UNSIGNED (prev_type)); > + { > + gcc_assert (VECTOR_MODE_P (intermediate_mode)); > + tree intermediate_element_type > + = lang_hooks.types.type_for_mode (GET_MODE_INNER > (intermediate_mode), > + TYPE_UNSIGNED (prev_type)); > + intermediate_type > + = build_vector_type_for_mode (intermediate_element_type, > + intermediate_mode); > + } > > if (VECTOR_BOOLEAN_TYPE_P (intermediate_type) > && VECTOR_BOOLEAN_TYPE_P (prev_type) > -- > 2.35.3 > >
Hi Richard, On 25/11/2022 21:08, Richard Biener via Gcc-patches wrote: > > > On Fri, 25 Nov 2022, Vaseeharan Vinayagamoorthy wrote: > > > Hi, > > > > I am seeing an internal compiler error, related to this patch: > > Can you please open a bugzilla for this and attach preprocessed > source so I can reproduce the ICE with a cc1 cross compiler? I've raised a PR for this with a reduced testcase here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107896 Thanks, Alex > > Thanks, > Richard. > > > > > during GIMPLE pass: slp > > > > options-save.cc: In function 'void cl_optimization_restore(gcc_options*, > > gcc_options*, cl_optimization*)': > > > > options-save.cc:1292:1: internal compiler error: in > > supportable_widening_operation, at tree-vect-stmts.cc:12199 > > > > � > > > > �1292 | cl_optimization_restore (struct gcc_options *opts, struct > > gcc_options *opts_set, > > > > �| ^~~~~~~~~~~~~~~~~~~~~~~ > > > > /�/src/gcc/gcc/profile-count.cc: In member function 'int > > profile_count::to_cgraph_frequency(profile_count) const': > > > > /�/src/gcc/gcc/profile-count.cc:308:1: note: parameter passing for argument > > of type 'profile_count' changed in GCC 9.1 > > > > �308 | profile_count::to_cgraph_frequency (profile_count entry_bb_count) > > const > > > > �| ^~~~~~~~~~~~~ > > > > /�/src/gcc/gcc/profile-count.cc: In member function 'sreal > > profile_count::to_sreal_scale(profile_count, bool*) const': > > > > /�/src/gcc/gcc/profile-count.cc:326:1: note: parameter passing for argument > > of type 'profile_count' changed in GCC 9.1 > > > > �326 | profile_count::to_sreal_scale (profile_count in, bool *known) const > > > > �| ^~~~~~~~~~~~~ > > > > 0x2195bdd supportable_widening_operation(vec_info*, tree_code, > > _stmt_vec_info*, tree_node*, tree_node*, tree_code*, tree_code*, int*, > > vec<tree_node*, va_heap, vl_ptr>*) > > > > �/�/src/gcc/gcc/tree-vect-stmts.cc:12199 > > > > 0x2180493 vectorizable_conversion > > > > �/�/src/gcc/gcc/tree-vect-stmts.cc:5064 > > > > 0x2192fdd vect_analyze_stmt(vec_info*, _stmt_vec_info*, bool*, _slp_tree*, > > _slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*) > > > > �/�/src/gcc/gcc/tree-vect-stmts.cc:11256 > > > > � > > > > /�/src/gcc/gcc/profile-count.cc: In member function 'profile_count > > profile_count::combine_with_ipa_count(profile_count)': > > > > /�/src/gcc/gcc/profile-count.cc:398:1: note: parameter passing for argument > > of type 'profile_count' changed in GCC 9.1 > > > > �398 | profile_count::combine_with_ipa_count (profile_count ipa) > > > > �| ^~~~~~~~~~~~~ > > > > 0x14f95d1 vect_slp_analyze_node_operations_1 > > > > �/�/src/gcc/gcc/tree-vect-slp.cc:5958 > > > > 0x14f9c19 vect_slp_analyze_node_operations > > > > �/�/src/gcc/gcc/tree-vect-slp.cc:6147 > > > > 0x14f9b4d vect_slp_analyze_node_operations > > > > �/�/src/gcc/gcc/tree-vect-slp.cc:6126 > > > > 0x14fa439 vect_slp_analyze_operations(vec_info*) > > > > �/�/src/gcc/gcc/tree-vect-slp.cc:6387 > > > > 0x14fd423 vect_slp_analyze_bb_1 > > > > �/�/src/gcc/gcc/tree-vect-slp.cc:7372 > > > > 0x14fd599 vect_slp_region > > > > �/�/src/gcc/gcc/tree-vect-slp.cc:7419 > > > > 0x14fe0d1 vect_slp_bbs > > > > �/�/src/gcc/gcc/tree-vect-slp.cc:7610 > > > > 0x14fe46f vect_slp_function(function*) > > > > �/�/src/gcc/gcc/tree-vect-slp.cc:7698 > > > > 0x151a109 execute > > > > �/�/src/gcc/gcc/tree-vectorizer.cc:1532 > > > > Please submit a full bug report, with preprocessed source (by using > > -freport-bug). > > > > Please include the complete backtrace with any bug report. > > > > See <https://gcc.gnu.org/bugs/> for instructions. > > > > Makefile:1146: recipe for target 'options-save.o' failed > > > > make[3]: *** [options-save.o] Error 1 > > > > > > > > That happens when building the�arm-none-linux-gnueabihf toolchain natively > > with glibc bootstrap: > > Build:arm-none-linux-gnueabihf > > Host:arm-none-linux-gnueabihf > > Target: arm-none-linux-gnueabihf > > > > The compiler being used to build the toolchain is gcc 7.5.0. > > > > > > Kind regards > > Vasee > > > > ____________________________________________________________________________ > > From: Gcc-patches <gcc-patches-bounces+vvinayag=arm.com@gcc.gnu.org> on > > behalf of Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> > > Sent: 22 November 2022 08:48 > > To: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org> > > Subject: [PATCH] tree-optimization/107672 - avoid vector mode type_for_mode > > call � > > The following avoids using type_for_mode on vector modes which might > > not work for all frontends.� Instead we look for the inner mode > > type and use build_vector_type_for_mode instead. > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. > > > > ������� PR tree-optimization/107672 > > ������� * tree-vect-stmts.cc (supportable_widening_operation): Avoid > > ������� type_for_mode on vector modes. > > --- > > �gcc/tree-vect-stmts.cc | 12 +++++++++--- > > �1 file changed, 9 insertions(+), 3 deletions(-) > > > > diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc > > index bc0ef136f19..b35b986889d 100644 > > --- a/gcc/tree-vect-stmts.cc > > +++ b/gcc/tree-vect-stmts.cc > > @@ -12195,9 +12195,15 @@ supportable_widening_operation (vec_info *vinfo, > > �������� intermediate_type > > ���������� = vect_halve_mask_nunits (prev_type, intermediate_mode); > > ������ else > > -������ intermediate_type > > -�������� = lang_hooks.types.type_for_mode (intermediate_mode, > > -������������������������������������������ TYPE_UNSIGNED (prev_type)); > > +������ { > > +�������� gcc_assert (VECTOR_MODE_P (intermediate_mode)); > > +�������� tree intermediate_element_type > > +���������� = lang_hooks.types.type_for_mode (GET_MODE_INNER > > (intermediate_mode), > > +�������������������������������������������� TYPE_UNSIGNED (prev_type)); > > +�������� intermediate_type > > +���������� = build_vector_type_for_mode (intermediate_element_type, > > +���������������������������������������� intermediate_mode); > > +������ } > > � > > ������ if (VECTOR_BOOLEAN_TYPE_P (intermediate_type) > > ���������� && VECTOR_BOOLEAN_TYPE_P (prev_type) > > -- > > 2.35.3 > > > >
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index bc0ef136f19..b35b986889d 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -12195,9 +12195,15 @@ supportable_widening_operation (vec_info *vinfo, intermediate_type = vect_halve_mask_nunits (prev_type, intermediate_mode); else - intermediate_type - = lang_hooks.types.type_for_mode (intermediate_mode, - TYPE_UNSIGNED (prev_type)); + { + gcc_assert (VECTOR_MODE_P (intermediate_mode)); + tree intermediate_element_type + = lang_hooks.types.type_for_mode (GET_MODE_INNER (intermediate_mode), + TYPE_UNSIGNED (prev_type)); + intermediate_type + = build_vector_type_for_mode (intermediate_element_type, + intermediate_mode); + } if (VECTOR_BOOLEAN_TYPE_P (intermediate_type) && VECTOR_BOOLEAN_TYPE_P (prev_type)