This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, PR 45934 1/6] [PR 46287] Do not generate direct calls to thunks


> Hi,
> 
> > I guess it is still fine as it is definite improvement over current
> > situation, but won't we need to handle all of cgraph_thunk_info
> > here?
> 
> Eventually we will, certainly before we start propagating constants to
> zeroth arguments of OBJ_TYPE_REFs.  And not only here but also at

I tought we do that via constant folding already.

> other places (e.g. cgraph_set_call_stmt and company... and of course
> there is the weird cgraph_create_edge_including_clones I wrote you
> about earlier).

Hmm...
> 
> > In thunk_info it is HOST_WIDE_INT, I would expect it to be here as well.
> 
> I extract it from BINFOs as tree constants and I need to use it in
> POINTER_PLUSes as tree constants so there is probably no point in
> striing it as H_W_I.

Well, it is similar for the thunk code. In a way I preffer constants to be constants
as they are easier to handle in GGC/LTO etc. but I do not care too much.
> > Should've test here if this parameter was eliminated or not?
> > (i.e. first bit of e->callee->clone.combined_args_to_skip?
> 
> It is not strictly necessary because I do the callee modification
> before removing parameters but on the second thought, yes, we should
> avoid creating unnecessary stuff when it is this easy.  So I will add
> the check and the condition will be:
> 
>   if (e->indirect_info && e->indirect_info->thunk_delta
>       && integer_nonzerop (e->indirect_info->thunk_delta)
>       && (!e->callee->clone.combined_args_to_skip
> 	  || !bitmap_bit_p (e->callee->clone.combined_args_to_skip, 0)))

OK...
> 
> > 
> > > Index: icln/gcc/ipa-prop.c
> > > ===================================================================
> > > --- icln.orig/gcc/ipa-prop.c
> > > +++ icln/gcc/ipa-prop.c
> > 
> > I would expect somewhere here to be code handling updating of operand
> > value for non-0 delta when doing ipa-cp propagation, but don't seem to
> > be able to find it?
> 
> What do you mean?  IPA-CP stores the delta into the indirect info
> structure of the corresponding edge and then the code in
> gimple_adjust_this_by_delta performs the adjustment.

Will then IPA-CP handle correctly call to thunk that calls to real function
that just passes pointer to other function?
> 
> > 
> > The rest seems OK.  I am most concerned that we implement just part of thunk
> > logic, but I see that you get deltas from BINFOs and the rest of adjustments
> > are not there?
> > 
> 
> Correct, for simple this adjusting thunks, BINFOs contain the decl of
> the real function and the this delta separately, for more complex
> thunks it stores the decl of an underlying thunk + a this delta which
> would otherwise be adjusted in this thunk.
> 
> And yes, we will certainly have to re-think how to represent thunks in
> the cgraph in a more general way.
> 
> Anyway, is the patch OK with the above change then?

OK.
Honza
> 
> Thanks,
> 
> Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]