From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 25B0B3858D37; Thu, 16 Nov 2023 06:54:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25B0B3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700117690; bh=bAU/OkdGASqVewC1mfeEMH7Z2Yq/8U+a/nE/rFeODQ0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=li0/EULFkGwkMzKc9m5Ch8OIOIEHqk41tLRITx8VBZ3XFiFWEplPhXdxvz+2d7d5a 9mye3PBAa6Yo2xYYj2Yux/SBhZX2Vmeerx8moEwTXr5ejujYOnyneDW0ftSY4qqg6N aH530lrswMHLK3K177dE5+vJyn14uYLU/tg+Vb9A= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/112554] [14 Regression] RISC-V ICE: verify_ssa failed with -O3 --param riscv-autovec-preference=fixed-vlmax Date: Thu, 16 Nov 2023 06:54:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112554 --- Comment #1 from CVS Commits --- The trunk branch has been updated by Lehua Ding : https://gcc.gnu.org/g:fc6f7ab4e078aaf52c37739da73eb6416f5ec788 commit r14-5516-gfc6f7ab4e078aaf52c37739da73eb6416f5ec788 Author: Juzhe-Zhong Date: Thu Nov 16 10:58:16 2023 +0800 VECT: Clear LOOP_VINFO_USING_SELECT_VL_P when loop is not partial vectorized This patch fixes ICE: https://godbolt.org/z/z8T6o6qov : In function 'b': :2:6: error: missing definition 2 | void b() { | ^ for SSA_NAME: loop_len_8 in statement: _1 =3D -loop_len_8; during GIMPLE pass: vect :2:6: internal compiler error: verify_ssa failed 0x7f1b56331082 __libc_start_main ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. Compiler returned: 1 The root cause is we generate such IR in vectorization: _1 =3D -loop_len_8; vect_cst__11 =3D {_1, _1}; _18 =3D vect_vec_iv_.6_14 + vect_cst__11; loop_len_8 is uninitialized value. The IR _18 =3D vect_vec_iv_.6_14 + vect_cst__11; is generated because o= f we are adding induction variable with the result of SELECT_VL instead of VF. The code is: else if (LOOP_VINFO_USING_SELECT_VL_P (loop_vinfo)) { /* When we're using loop_len produced by SELEC_VL, the non-final iterations are not always processing VF elements. So vectorize induction variable instead of _21 =3D vect_vec_iv_.6_22 + { VF, ... }; We should generate: _35 =3D .SELECT_VL (ivtmp_33, VF); vect_cst__22 =3D [vec_duplicate_expr] _35; _21 =3D vect_vec_iv_.6_22 + vect_cst__22; */ gcc_assert (!slp_node); gimple_seq seq =3D NULL; vec_loop_lens *lens =3D &LOOP_VINFO_LENS (loop_vinfo); tree len =3D vect_get_loop_len (loop_vinfo, NULL, lens, 1, vectyp= e, 0, 0); expr =3D force_gimple_operand (fold_convert (TREE_TYPE (step_expr= ), unshare_expr (len)), &seq, true, NULL_TREE); new_name =3D gimple_build (&seq, MULT_EXPR, TREE_TYPE (step_expr), expr, step_expr); gsi_insert_seq_before (&si, seq, GSI_SAME_STMT); step_iv_si =3D &si; } LOOP_VINFO_USING_SELECT_VL_P is set before loop vectorization analysis = so we don't know whether it is partial vectorization or not but the induction variable depends on SELECT_VL_P = is true. So update SELECT_VL_P as false when it is not partial vectorization. PR middle-end/112554 gcc/ChangeLog: * tree-vect-loop.cc (vect_determine_partial_vectors_and_peeling= ): Clear SELECT_VL_P for non-partial vectorization. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr112554.c: New test.=