[PATCH] D132345: [JITLink] Add support for symbol aliases.

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 11:42:08 PDT 2022


lhames added a comment.

Another approach worth considering: What if we treated alias relationships like module-level metadata? I.e. JITLink wouldn't enforce the invariant that aliases point to the same location. Symbols would remain fully independent (as they are now), and we would just track the symbolic "<a> is an alias for <b>" relationship metadata on the side. Clients would be responsible for updating that if/where needed (although it would be automatically updated on symbol removal to avoid leaving stale entries).

The advantages: Simpler LinkGraph implementation. Clients can still access the metadata, and it provides an easy way to work with aliases where needed (the alias and alias-tree iterators would remain). Clients that don't want or need to care about aliases can ignore them.

The disadvantage: the "intent" of the metadata would be obscured by any passes that move alias symbols relative to one another without explicitly updating the metadata. E.g. if you have a graph containing symbol A and an alias B of A, and pass X decides to move B only to a different location, what should a later pass make of the relationship "B is an alias of A"?

That disadvantage is real, but seems likely to be rare. Given that JITLink pipelines and passes are also likely to remain relatively simple I think we could take this module-level-metadata route and then update passes to preserve metadata as needed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132345/new/

https://reviews.llvm.org/D132345



More information about the llvm-commits mailing list