[PATCH] D36082: [Cloning] Move distinct GlobalVariable debug info metadata in CloneModule

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 12:34:24 PST 2021


dexonsmith added a comment.
Herald added a project: LLVM.

`RF_MoveDistinctMDs` is not safe to use in `llvm::CloneModule()`, since this flag causes the IRLinker to mutate distinct nodes instead of cloning them. That's only sound if the original module is being discarded after linking (e.g., when you want to link some bitcode in, you read it into an ephemeral module, link in what you want, and discard what's left). In `llvm::CloneModule()`, you'll end up with the original module referencing global variables owned by the cloned module.

I suspect adding `RF_MoveDistinctMDs` here papered over an underlying bug related to cloning `llvm.dbg.cu`. See my longer comment in:
https://bugs.llvm.org/show_bug.cgi?id=48841


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D36082/new/

https://reviews.llvm.org/D36082



More information about the llvm-commits mailing list