From e3f14b0e8c863c216d98928044c01ee8a2ee1d73 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sun, 29 Nov 2015 15:52:12 +0000 Subject: [PATCH] Add a passing test. When a comdat is discarded, any globals defined in it become undefined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254258 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/tools/gold/X86/Inputs/comdat2.ll | 9 +++++++++ test/tools/gold/X86/comdat2.ll | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/tools/gold/X86/Inputs/comdat2.ll create mode 100644 test/tools/gold/X86/comdat2.ll diff --git a/test/tools/gold/X86/Inputs/comdat2.ll b/test/tools/gold/X86/Inputs/comdat2.ll new file mode 100644 index 00000000000..5b7f74cf0b2 --- /dev/null +++ b/test/tools/gold/X86/Inputs/comdat2.ll @@ -0,0 +1,9 @@ +$foo = comdat any +@foo = global i8 1, comdat +define void @zed() { + call void @bar() + ret void +} +define void @bar() comdat($foo) { + ret void +} diff --git a/test/tools/gold/X86/comdat2.ll b/test/tools/gold/X86/comdat2.ll new file mode 100644 index 00000000000..2156efd207b --- /dev/null +++ b/test/tools/gold/X86/comdat2.ll @@ -0,0 +1,19 @@ +; RUN: llvm-as %s -o %t.bc +; RUN: llvm-as %p/Inputs/comdat2.ll -o %t2.bc +; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ +; RUN: --plugin-opt=emit-llvm \ +; RUN: -shared %t.bc %t2.bc -o %t3.bc +; RUN: llvm-dis %t3.bc -o - | FileCheck %s + + +$foo = comdat any +@foo = global i8 0, comdat + +; CHECK: @foo = global i8 0, comdat + +; CHECK: define void @zed() { +; CHECK: call void @bar() +; CHECK: ret void +; CHECK: } + +; CHECK: declare void @bar() -- 2.34.1