[LLVMdev] loop passes vs call graph

Jay Foad jay.foad at gmail.com
Fri Feb 13 05:52:41 PST 2009


> given the callgraph F -> G, the pass manager currently does the following:
> run inliner on G, run loop passes on G, run inliner on F, run loop
> passes on F.  Presumably what is happening is this: the loop passes change
> the functions that G calls (but don't update the callgraph).  Now the
> inliner visits F and decides to inline G into F.  When it does this, it
> presumably merges the callgraph info for G (i.e. what G calls) into that of
> F.  But this info is wrong, so F ends up having invalid callgraph info which
> at some point causes trouble.

Yes, exactly!

> I think what should happen is: if a SCC pass (eg: inline) is followed
> by function passes that preserve the callgraph, then it should schedule
> them together like above.  However if the SCC pass is followed by a
> function pass that does not preserve the callgraph then it should be
> scheduled entirely after the SCC pass.

Sounds good, but it's a bit outside my area of expertise.

I think it would be nice to have a call graph verifier, that checks
that the call graph is complete and correct whenever the pass manager
thinks it ought to be. Maybe it could be part of -verify - I'm not
sure how these things work.

Thanks,
Jay.



More information about the llvm-dev mailing list