Reputation: 757
Does anyone have any idea how to remove metadata from an instruction in LLVM-IR?
Upvotes: 1
Views: 1697
Reputation: 26878
To remove a specifc kind of metadata from an instruction, use setMetadata(kind, NULL)
. To remove all the metadata, call getAllMetadata
first, then iterate over the kinds in the returned collection and remove them via the first method.
Keep in mind that this will not remove the actual MDNode and will not remove any dbg.declare
or dbg.value
calls if that's what interests you.
Upvotes: 2