From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 644F4384640E; Thu, 25 Apr 2024 06:31:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 644F4384640E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714026686; bh=QuaYBI2oE5VOwZVTZXITH3TambW2irq/W53ookWEJ6w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UTIWyEQ/dXi0Au9/lg3Ch7ODpIaHWDBh1zUUHV/dt50B5C+zOpYgdGXYN0Teieco9 Yx7t4JyzsoEiFULohb22zFf479trD5QzwtfVaHtZzDy55xjh0Sfs3BtfJKOl0mI7R+ RWgzvm66yXrhWTNebGVgf8vyXBVoC+/LUvU9buL4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114734] [14] RISC-V rv64gcv_zvl256b miscompile with -flto -O3 -mrvv-vector-bits=zvl Date: Thu, 25 Apr 2024 06:31:25 +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: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW 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=3D114734 --- Comment #7 from Richard Biener --- (In reply to Robin Dapp from comment #6) > This one is really a bit tricky. >=20 > We have the following situation: >=20 > loop: > > # vectp_g.178_1078 =3D PHI =20 > _911 =3D &MEM... vectp_g.178_1078 > MASK_LEN_LOAD (_911, ...); > vectp_g.178_1079 =3D vectp_g.178_1078 + 16; > goto loop; >=20 > : > MASK_LEN_LOAD (_911, ...); >=20 > During expand we basically convert back the _911 to vectp_g.178_1078 > (reverting what we did in ivopts before). Because _911 camouflages > vectp_g.178_1078 until expand we evaded the conflict checks of outof-ssa > that would catch a similar, non-camouflaged situation like: >=20 > # vectp_g.178_1078 =3D PHI =20 > MASK_LEN_LOAD (MEM... vectp_g.178_1078, ...); > vectp_g.178_1079 =3D vectp_g.178_1078 + 16; > goto loop; > MASK_LEN_LOAD (MEM... vectp_g.178_1078, ...); >=20 > and would insert a copy of the definition right before the backedge. The > MASK_LEN_LOAD after the loop would then use that copy. By using _911 > instead of the original pointer no conflict is detected and we wrongly use > the incremented pointer. Without the ivopt change for TARGET_MEM_REF So you say we coalesce _1079 and _1078 but then apply TER to _911 which makes that coalescing invalid because now their lifetimes overlap? There must be some mechanisms to avoid this kind of situation so I do wonder whether it's not TER but some invalid SSA def stmt lookup that is happening upon expansion _not_ honoring the TER constaints here? That is, how do we exactly put the definition of _911 into the uses? Can you attach the RTL expansion dump?=