We have modules with metadata on declarations, and out-of-tree passes
use that metadata, and we need to clone those modules. We really expect
such metadata is kept during the clone operation.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Now that most features of CloneModule() are tested by the unit-test. Is there any specific reason to prefer lit-test over unit-test?
seems that copying the metadata causing the Cloned module still reference some metadata in source modules. and simplifyExternals(*MergedM); in ThinLTOBitcodeWriter.cpp modifies the metadata in the source module M. which is out-of my expectation. I am not familiar with that part of code, so still need some time to continue investigate. I am not sure @pcc Do you have any idea on this?
Actually it is changing a metadata in module M from:
!32 = !DITemplateValueParameter(type: !33, value: { i64, i64 } { i64 ptrtoint (i32 (%class.i*)* @_ZNK1i5m_fn1Ev to i64), i64 0 })
into
!32 = !DITemplateValueParameter(type: !33, value: { i64, i64 } { i64 ptrtoint (void ()* @_ZNK1i5m_fn1Ev to i64), i64 0 })
I dumped the modules before and after my change, this is the only diff of Module M before writing out.
Nit: LLVM coding style wants full sentences in comments.
i.e.: // Test global variable declarations.