summaryrefslogtreecommitdiffstats
path: root/llvm/test/Linker/comdat_group.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Linker/comdat_group.ll')
-rw-r--r--llvm/test/Linker/comdat_group.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Linker/comdat_group.ll b/llvm/test/Linker/comdat_group.ll
new file mode 100644
index 00000000000..efaa94f2858
--- /dev/null
+++ b/llvm/test/Linker/comdat_group.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as -function-summary %s -o %t.bc
+
+; Ensure complete comdat group is materialized
+; RUN: llvm-link %t.bc -S | FileCheck %s
+; CHECK: $linkoncecomdat = comdat any
+; CHECK: @linkoncecomdat = linkonce global i32 2
+; CHECK: @linkoncecomdat_unref_var = linkonce global i32 2, comdat($linkoncecomdat)
+; CHECK: define linkonce void @linkoncecomdat_unref_func() comdat($linkoncecomdat)
+
+$linkoncecomdat = comdat any
+@linkoncecomdat = linkonce global i32 2, comdat($linkoncecomdat)
+@linkoncecomdat_unref_var = linkonce global i32 2, comdat($linkoncecomdat)
+define linkonce void @linkoncecomdat_unref_func() comdat($linkoncecomdat) {
+ ret void
+}
+; Reference one member of comdat so that comdat is generated.
+define void @ref_linkoncecomdat() {
+ load i32, i32* @linkoncecomdat, align 4
+ ret void
+}
OpenPOWER on IntegriCloud