Metadata for MachineInstr

Hi all,

Just a quick question about passing information all the way down to machine code level. Metadata provides an excellent vehicle to pass extra ad-hoc information along the compilation pipeline. However, If I understand correctly, it seems that MachineInstr does not support metadata, by which I mean metadata cannot be attached to MachineInstr’s by now. Metadata can be bundled with Instruction class instances. The metadata attached to Instruction gets lost during code generation. Here is my question, is there a way to pass information attached to Instruction even further down to stages after code generation? NamedMetadata is a good example but it seems that it cannot be attached to Instruction or MachineInstr if I understand correctly. Is there something like DebugLoc which gets preserved all the way but more general than DebugLoc?

Thank you in advance.

It seems that adding a pointer-typed field to NamedMetadata into DebugLoc does not work when the pointer is serialized and deserialized in a .bc file. Is there a way to add a field into DebugLoc such that it can be serialized and deserialized?