[Bug middle-end/112406] [14 Regression] Several SPECCPU 2017 benchmarks fail with LTO on internal compiler error: in expand_insn, at optabs.cc:8305
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112406 --- Comment #6 from Tamar Christina --- First reduction: typedef struct { int red } MagickPixelPacket; GetImageChannelMoments_image, GetImageChannelMoments_image_0, GetImageChannelMoments___trans_tmp_1, GetImageChannelMoments_M11_0, GetImageChannelMoments_pixel_3, GetImageChannelMoments_y, GetImageChannelMoments_p; double GetImageChannelMoments_M00_0, GetImageChannelMoments_M00_1, GetImageChannelMoments_M01_1; MagickPixelPacket GetImageChannelMoments_pixel; SetMagickPixelPacket(int color, MagickPixelPacket *pixel) { pixel->red = color; } GetImageChannelMoments() { for (; GetImageChannelMoments_y; GetImageChannelMoments_y++) { SetMagickPixelPacket(GetImageChannelMoments_p, &GetImageChannelMoments_pixel); GetImageChannelMoments_M00_1 += GetImageChannelMoments_pixel.red; if (GetImageChannelMoments_image) GetImageChannelMoments_M00_1++; GetImageChannelMoments_M01_1 += GetImageChannelMoments_y * GetImageChannelMoments_pixel_3; if (GetImageChannelMoments_image_0) GetImageChannelMoments_M00_0++; GetImageChannelMoments_M01_1 += GetImageChannelMoments_y * GetImageChannelMoments_p++; } GetImageChannelMoments___trans_tmp_1 = atan(GetImageChannelMoments_M11_0); } reproduce with: gcc -march=armv8-a+sve -w -Ofast statistic.i -o statistic.o bisected to: 01c18f58d37865d5f3bbe93e666183b54ec608c7 is the first bad commit commit 01c18f58d37865d5f3bbe93e666183b54ec608c7 Author: Robin Dapp Date: Wed Sep 13 22:19:35 2023 +0200 ifcvt/vect: Emit COND_OP for conditional scalar reduction. As described in PR111401 we currently emit a COND and a PLUS expression for conditional reductions. This makes it difficult to combine both into a masked reduction statement later. This patch improves that by directly emitting a COND_ADD/COND_OP during ifcvt and adjusting some vectorizer code to handle it. It also makes neutral_op_for_reduction return -0 if HONOR_SIGNED_ZEROS is true. gcc/ChangeLog: PR middle-end/111401 * internal-fn.cc (internal_fn_else_index): New function. * internal-fn.h (internal_fn_else_index): Define. * tree-if-conv.cc (convert_scalar_cond_reduction): Emit COND_OP if supported. (predicate_scalar_phi): Add whitespace. * tree-vect-loop.cc (fold_left_reduction_fn): Add IFN_COND_OP. (neutral_op_for_reduction): Return -0 for PLUS. (check_reduction_path): Don't count else operand in COND_OP. (vect_is_simple_reduction): Ditto. (vect_create_epilog_for_reduction): Fix whitespace. (vectorize_fold_left_reduction): Add COND_OP handling. (vectorizable_reduction): Don't count else operand in COND_OP. (vect_transform_reduction): Add COND_OP handling. * tree-vectorizer.h (neutral_op_for_reduction): Add default parameter. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-cond-reduc-in-order-2-signed-zero.c: New test. * gcc.target/riscv/rvv/autovec/cond/pr111401.c: New test. * gcc.target/riscv/rvv/autovec/reduc/reduc_call-2.c: Adjust. * gcc.target/riscv/rvv/autovec/reduc/reduc_call-4.c: Ditto. -- I'll start on the exchange one now.
[Bug middle-end/112406] [14 Regression] Several SPECCPU 2017 benchmarks fail with LTO on internal compiler error: in expand_insn, at optabs.cc:8305
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112406 Tamar Christina changed: What|Removed |Added Ever confirmed|0 |1 Last reconfirmed||2023-11-08 Status|RESOLVED|REOPENED Resolution|FIXED |--- --- Comment #5 from Tamar Christina --- No, ICE is still there on imagick and on exchange it's changed to during GIMPLE pass: vect exchange2.fppized.f90: In function 'digits_2.isra': exchange2.fppized.f90:998:31: internal compiler error: in vect_get_vec_defs_for_operand, at tree-vect-stmts.cc:1257 998 | recursive subroutine digits_2(row) | ^ 0x1813b6b vect_get_vec_defs_for_operand(vec_info*, _stmt_vec_info*, unsigned int, tree_node*, vec*, tree_node*) /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vect-stmts.cc:1257 0x1813ceb vect_get_vec_defs(vec_info*, _stmt_vec_info*, _slp_tree*, unsigned int, tree_node*, vec*, tree_node*, tree_node*, vec*, tree_node*, tree_node*, vec*, tree_node*, tree_node*, vec*, tree_node*) /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vect-stmts.cc:1289 0x1813dcf vect_get_vec_defs(vec_info*, _stmt_vec_info*, _slp_tree*, unsigned int, tree_node*, vec*, tree_node*, vec*, tree_node*, vec*, tree_node*, vec*) /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vect-stmts.cc:1311 0xea9bc3 vect_transform_reduction(_loop_vec_info*, _stmt_vec_info*, gimple_stmt_iterator*, gimple**, _slp_tree*) /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vect-loop.cc:8470 0x18311fb vect_transform_stmt(vec_info*, _stmt_vec_info*, gimple_stmt_iterator*, _slp_tree*, _slp_instance*) /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vect-stmts.cc:13100 0xe9a223 vect_transform_loop_stmt /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vect-loop.cc:11322 0xeb79ff vect_transform_loop(_loop_vec_info*, gimple*) /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vect-loop.cc:11774 0xeedb4b vect_transform_loops /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vectorizer.cc:1006 0xeee18f try_vectorize_loop_1 /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vectorizer.cc:1152 0xeee18f try_vectorize_loop /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vectorizer.cc:1182 0xeee40f execute /opt/buildAgent/work/5c94c4ced6ebfcd0/gcc/tree-vectorizer.cc:1298 I'll reduce exchange first since less object files.
[Bug middle-end/112406] [14 Regression] Several SPECCPU 2017 benchmarks fail with LTO on internal compiler error: in expand_insn, at optabs.cc:8305
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112406 Richard Biener changed: What|Removed |Added Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #4 from Richard Biener --- Fixed I think.
[Bug middle-end/112406] [14 Regression] Several SPECCPU 2017 benchmarks fail with LTO on internal compiler error: in expand_insn, at optabs.cc:8305
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112406 --- Comment #3 from CVS Commits --- The master branch has been updated by Robin Dapp : https://gcc.gnu.org/g:fd940d248bfccb6994794152681dc4c693160919 commit r14-5231-gfd940d248bfccb6994794152681dc4c693160919 Author: Robin Dapp Date: Mon Nov 6 11:24:37 2023 +0100 vect/ifcvt: Add vec_cond fallback and check for vector versioning. This restricts tree-ifcvt to only create COND_OPs when we versioned the loop for vectorization. Apart from that it re-creates a VEC_COND_EXPR in vect_expand_fold_left if we emitted a COND_OP. gcc/ChangeLog: PR tree-optimization/112361 PR target/112359 PR middle-end/112406 * tree-if-conv.cc (convert_scalar_cond_reduction): Remember if loop was versioned and only then create COND_OPs. (predicate_scalar_phi): Do not create COND_OP when not vectorizing. * tree-vect-loop.cc (vect_expand_fold_left): Re-create VEC_COND_EXPR. (vectorize_fold_left_reduction): Pass mask to vect_expand_fold_left. gcc/testsuite/ChangeLog: * gcc.dg/pr112359.c: New test.
[Bug middle-end/112406] [14 Regression] Several SPECCPU 2017 benchmarks fail with LTO on internal compiler error: in expand_insn, at optabs.cc:8305
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112406 --- Comment #2 from Tamar Christina --- (In reply to Richard Biener from comment #1) > Possibly the same as PR112359? Some were yeah, looks like there are still 2 ICEs in imagick and exchange, I'll start reducing those.
[Bug middle-end/112406] [14 Regression] Several SPECCPU 2017 benchmarks fail with LTO on internal compiler error: in expand_insn, at optabs.cc:8305
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112406 Richard Biener changed: What|Removed |Added Target Milestone|--- |14.0 --- Comment #1 from Richard Biener --- Possibly the same as PR112359?