[RFC][Cloning] A potential bug when cloning GV declarations

Hi,

Currently in llvm::CloneModule, if a global variable (GV) is a declaration, we won’t assign a initializer, copy the metadata, and copy the comdat. (https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Utils/CloneModule.cpp#L120)

However, if we don’t copy metadata for GV declarations, some optimizations might be missing due to the lack of information provided by metadata.

I’m wondering whether there is any comment or objection if we copy metadata for GV declarations.

Thank you