aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-09-13 01:12:59 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-09-13 01:12:59 +0000
commitd4135bbc30de3d3dbd44d64d718fb2169f41bae0 (patch)
tree0b96e34c50822aed89a2272d9e9f3688bc3a0e46 /llvm/lib/Linker/IRMover.cpp
parent[DAG] Refactor BUILD_VECTOR combine to make it easier to extend. NFCI. (diff)
downloadllvm-project-d4135bbc30de3d3dbd44d64d718fb2169f41bae0.tar.gz
llvm-project-d4135bbc30de3d3dbd44d64d718fb2169f41bae0.tar.bz2
llvm-project-d4135bbc30de3d3dbd44d64d718fb2169f41bae0.zip
DebugInfo: New metadata representation for global variables.
This patch reverses the edge from DIGlobalVariable to GlobalVariable. This will allow us to more easily preserve debug info metadata when manipulating global variables. Fixes PR30362. A program for upgrading test cases is attached to that bug. Differential Revision: http://reviews.llvm.org/D20147 llvm-svn: 281284
Diffstat (limited to 'llvm/lib/Linker/IRMover.cpp')
-rw-r--r--llvm/lib/Linker/IRMover.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index c02abd7e3aca..5a00aae7e8a2 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -465,7 +465,7 @@ class IRLinker {
Error linkModuleFlagsMetadata();
- void linkGlobalInit(GlobalVariable &Dst, GlobalVariable &Src);
+ void linkGlobalVariable(GlobalVariable &Dst, GlobalVariable &Src);
Error linkFunctionBody(Function &Dst, Function &Src);
void linkAliasBody(GlobalAlias &Dst, GlobalAlias &Src);
Error linkGlobalValueBody(GlobalValue &Dst, GlobalValue &Src);
@@ -942,7 +942,9 @@ Expected<Constant *> IRLinker::linkGlobalValueProto(GlobalValue *SGV,
/// Update the initializers in the Dest module now that all globals that may be
/// referenced are in Dest.
-void IRLinker::linkGlobalInit(GlobalVariable &Dst, GlobalVariable &Src) {
+void IRLinker::linkGlobalVariable(GlobalVariable &Dst, GlobalVariable &Src) {
+ Dst.copyMetadata(&Src, 0);
+
// Figure out what the initializer looks like in the dest module.
Mapper.scheduleMapGlobalInitializer(Dst, *Src.getInitializer());
}
@@ -985,7 +987,7 @@ Error IRLinker::linkGlobalValueBody(GlobalValue &Dst, GlobalValue &Src) {
if (auto *F = dyn_cast<Function>(&Src))
return linkFunctionBody(cast<Function>(Dst), *F);
if (auto *GVar = dyn_cast<GlobalVariable>(&Src)) {
- linkGlobalInit(cast<GlobalVariable>(Dst), *GVar);
+ linkGlobalVariable(cast<GlobalVariable>(Dst), *GVar);
return Error::success();
}
linkAliasBody(cast<GlobalAlias>(Dst), cast<GlobalAlias>(Src));