From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D85FC385ED4A; Tue, 4 May 2021 16:36:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D85FC385ED4A From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/100342] [10/11 Regression] wrong code with -O2 -fno-dse -fno-forward-propagate -mno-sse2 Date: Tue, 04 May 2021 16:36:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 11.1.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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: 10.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 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, 04 May 2021 16:36:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100342 --- Comment #9 from Jakub Jelinek --- Looking at current 10 branch (previously looked at 11), I see: (insn 2741 1965 368 2 (set (reg:DI 42 r14 [orig:2067 u128_0 ] [2067]) (mem/c:DI (plus:DI (reg/f:DI 7 sp) (const_int 56 [0x38])) [9 %sfp+-1032 S8 A64])) "pr100342.c":65:24 66 {*movdi_internal} (nil)) ... (insn 613 612 1970 2 (set (reg:QI 4 si [orig:125 _98 ] [125]) (reg:QI 42 r14 [orig:2067 u128_0 ] [2067])) "pr100342.c":68:15 69 {*movqi_internal} (nil)) ... (insn 2737 1971 615 2 (set (reg:DI 6 bp [orig:2067 u128_0 ] [2067]) (reg:DI 42 r14 [orig:2067 u128_0 ] [2067])) "pr100342.c":68:12 66 {*movdi_internal} (nil)) ... (insn 2275 658 659 2 (set (reg:DI 1 dx [2225]) (reg:DI 4 si [orig:125 _98 ] [125])) "pr100342.c":68:12 66 {*movdi_internal} (nil)) ... (insn 2287 2286 710 2 (set (reg:DI 1 dx [orig:131 _104 ] [131]) (reg:DI 6 bp [orig:2067 u128_0 ] [2067])) "pr100342.c":72:5 66 {*movdi_internal} (nil)) (insn 710 2287 2172 2 (set (reg:DI 1 dx [orig:131 _104 ] [131]) (bswap:DI (reg:DI 1 dx [orig:131 _104 ] [131]))) "pr100342.c":72:5 = 872 {*bswapdi2} (nil)) in the reload dump and I must say I don't find anything wrong on that, what looks wrong is that regcprop thinks that the insn 2287 is a redundant = move because it thinks that at that point %rdx contains the same value as %rbp - /* Detect noop sets and remove them before processing side effects. = */ if (set && REG_P (SET_DEST (set)) && REG_P (SET_SRC (set))) { unsigned int regno =3D REGNO (SET_SRC (set)); rtx r1 =3D find_oldest_value_reg (REGNO_REG_CLASS (regno), SET_DEST (set), vd); rtx r2 =3D find_oldest_value_reg (REGNO_REG_CLASS (regno), SET_SRC (set), vd); if (rtx_equal_p (r1 ? r1 : SET_DEST (set), r2 ? r2 : SET_SRC (set= ))) { bool last =3D insn =3D=3D BB_END (bb); delete_insn (insn); r1 is %rbp and r2 is NULL, so it is compared against SET_SRC (set) of %rbp. Something misses that only the lowpart QImode is equivalent that way.=