How to add custom annotations to assembly or disassembly files

I’ve developed a pass that adds some instructions into LLVM-IR. To facilitate the distinction between the original instructions and those added by my custom pass, I include metadata with the instructions generated by my custom pass. For Example:

%1 = load i64, i64* %0, align 8, !my-metadata !4

However, when LLVM-IR is converted into assembly code, the metadata is lost.

Consequently, it becomes challenging to differentiate between the original instructions and the ones added by my custom pass without scrutinizing the entire assembly code. Therefore, I’m seeking a solution to annotate the assembly or disassembly based on the metadata associated with LLVM-IR instructions.

Is it possible to add comments to the assembly or disassembly code based on the metadata attached to LLVM-IR instructions or any other way to annotate the assembly/disassembly?

Thanks :slight_smile: