LLVM Value relationship with metadata

Hello All,

Would anybody explain why there is not direct connection between llvm::Value
and metadata nodes. If llvm::Value hold pointer to its MDNode would it cause
any malfunctioning?

Thanks in advance,
Arsen

The rationale was that most values did not have any metadata, and therefore there would be a space penalty paid for every node. Increasingly, it seems that nodes have several metadata nodes and so they are all paying the time penalty for the lookup. It is probably worth doing some profiling to see what the costs are. At low optimisation levels, there is a lot of debug metadata. At higher ones, there is a lot of TBAA metadata.

David

Thanks for your reply David. Would you please clarify what do you mean by
saying:

David Chisnall-5 wrote

Increasingly, it seems that nodes have several metadata nodes and so they
are all paying the time penalty for the lookup.

Arsen

I mean that metadata has gone from being something that occasionally appeared, and then mainly in debug mode, to something that appears on a large number of instructions. The current design was created when metadata was both rarely created and rarely queried. It is now far more frequently created, although it may still be relatively infrequently queried (mainly TBAA, debug info writing). It is therefore probably worth profiling whether the original design decisions are still correct.

David

Thanks for clarifications

Arsen