From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 63A733858D35; Fri, 16 Jun 2023 21:58:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63A733858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686952686; bh=2mcPSK9R8Pu/RPj5iSkGhBog0n8u44NO199iw/8jr8o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VUd7EYB79KuJz37wmM+BTy9x3fTRuHEo0+w7Ux8sEs2GbfHGBIwYoLf4BjTXGfisy JOCqj7iZo3V/GOZ1rLKTcmi6ehiwrKQbcvlrQhGCFlmSorTDCbzmx8MlYikuL5ILGG uNK6EmVP/XixiyQ/QsO2t/PbBv7JrH5zXHKeXDjA= From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54089] [SH] Refactor shift patterns Date: Fri, 16 Jun 2023 21:58:06 +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: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: olegendo 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=3D54089 --- Comment #76 from Oleg Endo --- (In reply to Alexander Klepikov from comment #75) > I found that patch incorrectly works when '-O0 -fmove-loop-invariants' fl= ags > are set. Stock loop optimization passes do not run when '-O0' is specified > desipte '-fmove-loop-invariants' is set. I'll do the same and recheck aga= in. It'd be good if the newly added passes are ran only with -O2 or higher. Or even better, if we can find a way to enable them only when actually needed.= =20 E.g. when it's splitting a shift insn that will potentially need the loop optimizations again, set a flag in the function. One way to do that could be adding SH specific function context class/struc= t to store some per-function data for the compilation process. Right now we'd h= ave only one entry, that is whether to run the additional passes again or not.= =20 This per-function 'SH context' can be stored as a global variable in sh.cc.= =20 Then override 'set_current_function' in the backend to reset the SH specific per-function context. However, to get better test coverage, it's better first let the additional = loop passes run all the time to uncover any potential issues. Later the above c= an be added as a supplementary optimization.=