From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B02B83858D32; Mon, 15 Aug 2022 09:47:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B02B83858D32 From: "sebastien.michelland@ens-lyon.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/106609] [SH] miscompilation of loop involving noreturn call Date: Mon, 15 Aug 2022 09:47:06 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: sebastien.michelland@ens-lyon.fr 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: Mon, 15 Aug 2022 09:47:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106609 --- Comment #2 from S=C3=A9bastien Michelland --- Yes there are delay slots for all branches except bt and bf, so here bt.s, = jsr and rts all have one. (-fno-delayed-branches avoids them but that doesn't affect the bad optimization in this case.) Adding -fno-schedule-insns -fno-schedule-insns2 doesn't help; the test and = load are still eliminated. In fact, I negated the entirety of -Q --help=3Doptimi= zers and still got an incorrect output. It seems that the problem lies further downstream. I dumped various RTL sta= ges and -fdump-rtl-mach is the first stage where the comparison to 0 is gone, if the order in the manual is anything to go by. Since I have both functional = and non-functional outputs from different RTL stages, I'm switching the compone= nt to rtl-optimization.=