On Sat, Jul 6, 2024 at 6:07 PM Andi Kleen <a...@linux.intel.com> wrote:
>
> > > +class pass_musttail : public gimple_opt_pass
> > > +{
> > > +public:
> > > +  pass_musttail (gcc::context *ctxt)
> > > +    : gimple_opt_pass (pass_data_musttail, ctxt)
> > > +  {}
> > > +
> > > +  /* opt_pass methods: */
> > > +  /* This pass is only used when not optimizing to make [[musttail]] 
> > > still
> > > +     work.  */
> > > +  bool gate (function *) final override { return 
> > > !flag_optimize_sibling_calls; }
> >
> > Shouldn't this check f->has_musttail only?  That is, I would expect
> > -fno-optimize-sibling-calls to still tail-call [[musttail]]?  The comment 
> > says
> > the pass only runs when not optimizing - so maybe you wanted to do
> > return optimize == 0;?
>
> When flag_optimize_sibling_call is set the other tailcall pass will
> take care of the musttails. It is only needed when that one doesn't run.
> So I think looking at that flag is correct.

Ah, I see.  So this pass is responsible for both -O0 and
-fno-optimized-sibling-calls.
But I'm quite sure the other pass doesn't run with -O0
-foptimize-sibling-calls, does it?

> But I should move the f->has_musttail check into the gate (done) and
> clarified the comment because it is not specific to optimizing.

Yeah, clarifying the comment would be nice.

Thanks,
Richard.

> Thanks,
> -Andi

Reply via email to