The current representation of TBAA is the very last in-tree user of the llvm.metadata operation.
Using ops to model metadata has a few disadvantages:
- Building a graph has to be done through some weakly typed indirection mechanism such as SymbolRefAttr
- Creating the metadata has to be done through a builder within a metadata op.
- It is not multithreading safe as operation insertion into the same block is not thread-safe
This patch therefore converts TBAA metadata into an attribute representation, in a similar manner as it has been done for alias groups and access groups in previous patches.
This additionally has the large benefit of giving us more "correctness by construction" as it makes things like cycles in a TBAA graph, or references to an incorrectly typed metadata node impossible.
Would it make sense to use an array of structs instead of two arrays for member and offests?