[PATCH] IPA: MODREF should skip EAF_* flags for indirect calls

Richard Biener richard.guenther@gmail.com
Mon Aug 23 12:42:28 GMT 2021

On Mon, Aug 23, 2021 at 2:02 PM Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> >
> > Why does it "punish" -fno-ipa-pta?  It merely "punishes" modref of
> > no longer claiming that we do not alter the instruction stream pointed
> > to by a->foo, sth that shouldn't be very common.
> For example
> struct a {
>   void (*foo)();
>   void *bar;
> }
> fn(struct a *a)
> {
>    a->foo();
> }
> With Maritn's patch we will drop EAF flags of A to NODIRECTESCAPE since
> we will think its derefernece is is used in all posible ways.
> With my patch we get NOT_RETURNED | NOESCAPE.
> Still we will make PTA to think that whatever is pointed to by bar may
> be clobbered and this seems unnecessary.
> I have to look into ipa-pta how it haldnes the "instruction stream
> clobbering". I was not aware it does something smart about indirect
> calls.

It actually isn't "smart" but it simply makes indirect calls exactly
the same as direct calls so if you have

 (*ESCAPED) (a, b, c);

then it magically appears as a function call to all IPA PTA handled
functions that escaped.  So some handling is needed for correctness
and yes, it's fancier than simply assuming all address-taken functions
have unknown incoming parameters.


> Honza

More information about the Gcc-patches mailing list