This is an archive of the discontinued LLVM Phabricator instance.

[LCG] Add aliased functions as LCG roots
ClosedPublic

Authored by Carrot on Mar 27 2019, 1:24 PM.

Details

Summary

Current LCG doesn't check aliased functions. So if an internal function has a public alias it will not be added to CG SCC, but it is still reachable from outside through the alias.
So this patch adds aliased functions to SCC.

Diff Detail

Event Timeline

Carrot created this revision.Mar 27 2019, 1:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2019, 1:24 PM
tejohnson added inline comments.Mar 27 2019, 1:54 PM
lib/Analysis/LazyCallGraph.cpp
205

Presumably aliases with internal linkage themselves can be ignored.

Carrot updated this revision to Diff 192518.Mar 27 2019, 2:13 PM
Carrot marked an inline comment as done.
chandlerc requested changes to this revision.Mar 27 2019, 4:41 PM

Good catch!

lib/Analysis/LazyCallGraph.cpp
204

I would rewrite the comment to more closely match the patch description: "Externally visible aliases of internal functions are also viable entry edges to the module."

205–213

All of this should go above I think, right after we walk the module. We want to have the complete entry edge set before we visit globals and do the reference visit walk.

209–210

Include the fact that it is being added due to an alias, and the name of that alias?

test/Analysis/LazyCallGraph/alias.ll
4

Also test that internal aliases *don't* become reachable?

This revision now requires changes to proceed.Mar 27 2019, 4:41 PM
Carrot updated this revision to Diff 192705.Mar 28 2019, 1:00 PM
Carrot marked 4 inline comments as done.
chandlerc accepted this revision.Apr 4 2019, 3:35 PM

LGTM!

test/Analysis/LazyCallGraph/alias.ll
24

nit: can drop this comment.

31

nit: same

39

nit: same

This revision is now accepted and ready to land.Apr 4 2019, 3:35 PM
Carrot updated this revision to Diff 193926.Apr 5 2019, 11:47 AM
Carrot marked 3 inline comments as done.

Will check in this version.

This revision was automatically updated to reflect the committed changes.