From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A0C1C3858D37; Sun, 28 Apr 2024 06:51:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0C1C3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714287073; bh=70fRsZ0DWoOXK1HRKkahm++2sCYn/zXJI7hvp2dvf2c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=y3gamHOPI1mnu89QzJtyWBMsdGFW0LrzoO2QzrX9aqqdh8Z1QY/PDv40iT9YA1p4N JZZKl9mpSKk5lJcm/U12G580ZrO8GiklKPQVcTxvtYUvjsCL0qCBFqL+cDPG8QE26j efngX1Q2UlEVM6SWRa66yT+q0ekuaz2lrnJi5gFI= From: "pan2.li at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114639] [riscv] ICE in create_pre_exit, at mode-switching.cc:451 Date: Sun, 28 Apr 2024 06:51:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pan2.li at intel dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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=3D114639 --- Comment #19 from Li Pan --- Thanks Juzhe. Here is another example --------------------------------- #include extern size_t get_new_vl (); size_t __attribute__((noinline)) get_vl (size_t *c) { size_t vl =3D c[0] + c[1]; return vl; } vbool64_t test_fail_2 (vuint64m1_t a, unsigned long b, size_t *c) { return __riscv_vmsne_vx_u64m1_b64 (a, b, get_vl (c)); } ------------------------------------------------------- test_fail_2:=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 [30/37834] addi sp,sp,-16 sd ra,8(sp) sd s0,0(sp) csrr t0,vlenb sub sp,sp,t0 vs1r.v v1,0(sp) sub sp,sp,t0 vs1r.v v2,0(sp) sub sp,sp,t0 vs1r.v v3,0(sp) sub sp,sp,t0 vs1r.v v4,0(sp) sub sp,sp,t0 vs1r.v v5,0(sp) sub sp,sp,t0 vs1r.v v6,0(sp) sub sp,sp,t0 vs1r.v v7,0(sp) sub sp,sp,t0 vs1r.v v24,0(sp) sub sp,sp,t0 vs1r.v v25,0(sp) sub sp,sp,t0 vs1r.v v26,0(sp) sub sp,sp,t0 vs1r.v v27,0(sp) sub sp,sp,t0 vs1r.v v28,0(sp) sub sp,sp,t0=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 vs1r.v v29,0(sp)= =20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 sub sp,sp,t0 vs1r.v v30,0(sp) sub sp,sp,t0 vs1r.v v31,0(sp) csrr t0,vlenb sub sp,sp,t0 vs1r.v v8,0(sp) mv s0,a0 mv a0,a1 call get_vl vl1re64.v v8,0(sp) vsetvli zero,a0,e64,m1,ta,ma vmsne.vx v0,v8,s0 csrr t0,vlenb add sp,sp,t0 csrr t0,vlenb vl1re64.v v31,0(sp) add sp,sp,t0 vl1re64.v v30,0(sp) add sp,sp,t0 vl1re64.v v29,0(sp) add sp,sp,t0 vl1re64.v v28,0(sp) ... As I understand, these callee saved vector registers are not required if the function body doesn't pollute these registers. Only the polluted registers need to go in/out stack. However, it is somehow one optimization here, we can consider to improve th= is in GCC-15 if my understanding is correct.=