From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 995D63858C56; Wed, 10 Apr 2024 08:36:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 995D63858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712738170; bh=2fO0hrBu9QebGXic4pQVtVHDndm2cicll/URODlxryY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Bf2v36GEo79dIdEhuPjIZcQR61d0yz6gW2e0WSGdeU5RElC2rk8qkqg4R0LeH4GiA lsZODLVH7rbbYGsjJPKryr14fsXG+ZcNJaFfLiu5jFt0xBSufAVPJRGaWsDZ6ebp2m UI9YfrQdq6pF+Ekg7Lf3Kr8/cdaZOURB2h2ddkkQ= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114591] [12/13/14 Regression] register allocators introduce an extra load operation since gcc-12 Date: Wed, 10 Apr 2024 08:36:04 +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: 13.2.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 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=3D114591 --- Comment #6 from Uro=C5=A1 Bizjak --- LRA starts with this: 5: r98:SI=3D[`v1'] REG_EQUIV [`v1'] 6: [`v2']=3Dzero_extend(r98:SI) 7: r101:HI=3Dr98:SI#0 REG_DEAD r98:SI 12: ax:HI=3Dr101:HI REG_DEAD r101:HI 13: use ax:HI then decides that: Removing equiv init insn 5 (freq=3D1000) 5: r98:SI=3D[`v1'] REG_EQUIV [`v1'] and substitutes all follow-up usages of r98 with a memory access. In insn 6= , we have: (mem/c:SI (symbol_ref:DI ("v1"))) while in insn 7 we have: (mem/c:HI (symbol_ref:DI ("v1"))) It looks that different modes of memory read confuse LRA to not CSE the rea= d. IMO, if the preloaded value is later accessed in different modes, LRA should leave it. Alternatively, LRA should CSE memory accesses in different modes. Cc LRA expert ... oh, he already is in the loop.=