This is an archive of the discontinued LLVM Phabricator instance.

[CallGraphUpdater] Update the ExternalCallingNode for node replacements
ClosedPublic

Authored by jdoerfert on Apr 9 2020, 8:04 PM.

Details

Summary

While it is uncommon that the ExternalCallingNode needs to be updated,
it can happen. It is uncommon because most functions listed as callees
have external linkage, modifying them is usually not allowed. That said,
there are also internal functions that have, or better had, their
"address taken" at construction time. We conservatively assume various
uses cause the address "to be taken". Furthermore, the user might have
become dead at some point. As a consequence, transformations, e.g., the
Attributor, might be able to replace a function that is listed
as callee of the ExternalCallingNode.

Since there is no function corresponding to the ExternalCallingNode, we
did just remove the node from the callee list if we replaced it (so
far). Now it would be preferable to replace it if needed and remove it
otherwise. However, removing the node has implications on the CGSCC
iteration. Locally, that caused some other nodes to be never visited
but it is for sure possible other (bad) side effects can occur. As it
seems conservatively safe to keep the new node in the callee list we
will do that for now.

Diff Detail

Event Timeline

jdoerfert created this revision.Apr 9 2020, 8:04 PM
Herald added a reviewer: uenoku. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript

Is it difficult to create a test case for this?

Add test case

This revision is now accepted and ready to land.Apr 12 2020, 10:33 AM
This revision was automatically updated to reflect the committed changes.