From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EDA6B385AC2F; Tue, 27 Jul 2021 15:25:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDA6B385AC2F From: "segher at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/78103] Failure to optimize with __builtin_clzl Date: Tue, 27 Jul 2021 15:25:41 +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: 6.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: segher at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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, 27 Jul 2021 15:25:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D78103 --- Comment #20 from Segher Boessenkool --- (In reply to Jakub Jelinek from comment #18) > (In reply to Segher Boessenkool from comment #17) > > > Nothing changes for combine though, I think it really would be nice i= f it > > > could either change newly added pseudos from combine_split_insns by i= 2dest > > > if possible, > >=20 > > Is that ever safe to do? >=20 > Except for debug insns if the mode is the same and i2dest doesn't appear = in > i2set nor i3set nor anything in between, why not? You need to do the same twenty not-very-trivial-and-not-cheap-either checks as we have to do in similar cases. And try to get that right :-/ You also need to check i2dest does no longer appear in the new i2 and i3, for example. And for what? What is the benefit? > > > or better handle new pseudos from both combine_split_insns and > > > when > > > for find_split_point i2dest can't be resued with creating LOG_LINKS. > >=20 > > You cannot safely attempt to combine the two insns split to again, neit= her > > alone nor in combination with other insns. Since pretty much by defini= tion > > that new reg will be set in the new i2 and used in (only) in the new i3, > > no combination with that new reg is valid ever? >=20 > Sure, combining those 2 insns can't be sucessful, otherwise it would have > matched earlier. But they can be combined with other insns, say the first > of those 2 split insns being i0 and second i1 combined into some other i3 > and i2, > or perhaps just split insns i1 and i2 combined into some other i3. But there is nothing checking anything of the sort, and that would be really awkward to fit in with the existing mechanics, if it is possible at all.=