From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 02FEF385C017; Tue, 24 Mar 2020 13:15:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02FEF385C017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585055704; bh=S5fRyvpe0VH+3ZLLrDV/4be9s/qjESJ4rxCF0GwtqM4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dcdOAPhy/ZJ213X17VP62zOdp8sbE/jf49/MJVuaqhb25NuOcOQFM3a9xWT+5ULws zQOMO88SWXsqWuHtahD7kJsqkAYsslf14H74peXg03HFWjFrlqlKKudS7TQd4a3Avg 8QKUyIcBieP/L2Rem2KN7v9tuD6nae6/yKFCSRr8= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/94298] x86 duplicates loads Date: Tue, 24 Mar 2020 13:15:03 +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: 10.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Mar 2020 13:15:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94298 --- Comment #1 from Uro=C5=A1 Bizjak --- The situation is a bit more complicated. IRA DTRT: 8: r85:V2DF=3D[r86:DI+`y'] REG_EQUIV [r86:DI+`y'] 11: r89:V2DF=3Dvec_select(vec_concat(r85:V2DF,r85:V2DF),parallel) 12: r90:V2DF=3Dvec_select(vec_concat(r85:V2DF,r85:V2DF),parallel) REG_DEAD r85:V2DF Later, LRA propagates memory operand into the insn. Since the insn clobbers= its input, multiple loads are emitted: 26: xmm1:V2DF=3D[ax:DI+`y'] 11: xmm1:V2DF=3Dvec_select(vec_concat(xmm1:V2DF,[ax:DI+`y']),parallel) 28: xmm0:V2DF=3D[ax:DI+`y'] 12: xmm0:V2DF=3Dvec_select(vec_concat([ax:DI+`y'],xmm0:V2DF),parallel) which is further "optimized" in postreload pass: 26: xmm1:V2DF=3D[ax:DI+`y'] 11: xmm1:V2DF=3Dvec_select(vec_concat(xmm1:V2DF,xmm1:V2DF),parallel) 28: xmm0:V2DF=3D[ax:DI+`y'] 12: xmm0:V2DF=3Dvec_select(vec_concat(xmm0:V2DF,xmm0:V2DF),parallel) It looks to me that a heuristics is missing in LRA, where memory operand shouldn't propagate into insn, if there are multiple uses of a register.=