summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f0a04c0)
This reverts commit r251965.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252319
91177308-0d34-0410-b5e6-
96231b3b80d8
linkGlobalValueBody(Src);
}
linkGlobalValueBody(Src);
}
- // Remap all of the named MDNodes in Src into the DstM module. We do this
- // after linking GlobalValues so that MDNodes that reference GlobalValues
- // are properly remapped.
- linkNamedMDNodes();
-
- // Merge the module flags into the DstM module.
- if (linkModuleFlagsMetadata())
- return true;
-
// Update the initializers in the DstM module now that all globals that may
// be referenced are in DstM.
for (GlobalVariable &Src : SrcM->globals()) {
// Update the initializers in the DstM module now that all globals that may
// be referenced are in DstM.
for (GlobalVariable &Src : SrcM->globals()) {
+ // Remap all of the named MDNodes in Src into the DstM module. We do this
+ // after linking GlobalValues so that MDNodes that reference GlobalValues
+ // are properly remapped.
+ linkNamedMDNodes();
+
+ // Merge the module flags into the DstM module.
+ if (linkModuleFlagsMetadata())
+ return true;
+
--- /dev/null
+@X = external global i32
+
+declare i32 @foo()
+
+define void @bar() {
+ load i32, i32* @X
+ call i32 @foo()
+ ret void
+}
--- /dev/null
+; RUN: llvm-as %S/only-needed-named-metadata.ll -o %t.bc
+; RUN: llvm-as %S/Inputs/only-needed-named-metadata.ll -o %t2.bc
+; RUN: llvm-link -S -only-needed %t2.bc %t.bc | FileCheck %s
+; RUN: llvm-link -S -internalize -only-needed %t2.bc %t.bc | FileCheck %s
+
+; CHECK: @U = external global i32
+; CHECK: declare i32 @unused()
+
+@X = global i32 5
+@U = global i32 6
+define i32 @foo() { ret i32 7 }
+define i32 @unused() { ret i32 8 }
+
+!llvm.named = !{!0, !1}
+!0 = !{i32 ()* @unused}
+!1 = !{i32* @U}