On Wed, May 7, 2025 at 12:29 AM Andi Kleen <a...@firstfloor.org> wrote: > > On 2025-05-06 09:48, H.J. Lu wrote: > > On Mon, May 5, 2025 at 9:56 PM Andi Kleen <a...@firstfloor.org> wrote: > >> > >> On Mon, May 05, 2025 at 06:20:40AM -0700, Andi Kleen wrote: > >> > > If the branch edge destination is a basic block with only a direct > >> > > sibcall, change the jcc target to the sibcall target, decrement the > >> > > destination basic block entry label use count and redirect the edge > >> > > to the exit basic block. Call delete_unreachable_blocks to delete > >> > > the unreachable basic blocks at the end if edges are redirected. > >> > > >> > Its hard to believe this needs a new pass. Could the existing middle end > >> > tail call code handle it somehow? > >> > >> On further thought it absolutely needs to be in calls.c, otherwise it > >> cannot work with musttail. Currently musttail would error out before > >> this pass runs. > > > > Do you have a testcase? Since this pass is run just before > > pass_convert_to_eh_region_ranges, I think it should work with > > musttail. > > > I can't try it right now, but since the RTL musttail checks are in RTL > expand it is clear any RTL pass is too late. Put it into a target hook > and call it from calls.cc when it expands sibcalls. At that point the > sibcall discovery is already done so it will need less code too >
What does musttail check do? My patch doesn't remove sibcall. I don't see how it impacts musttail check. -- H.J.