[llvm] r254174 - Add a few passing lto tests.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 26 11:53:13 PST 2015
Author: rafael
Date: Thu Nov 26 13:53:12 2015
New Revision: 254174
URL: http://llvm.org/viewvc/llvm-project?rev=254174&view=rev
Log:
Add a few passing lto tests.
I found these while trying to get a prototype to bootstrap.
They cover things like
* Handling of non linker visible stuff (append, available_externally)
* Type merging
* Alias to dropped globals
* Dropping linkage when converting to a declaration.
These should hopefully be generally useful for anyone refactoring the
plugin.
Added:
llvm/trunk/test/tools/gold/X86/Inputs/ctors2.ll
llvm/trunk/test/tools/gold/X86/Inputs/drop-linkage.ll
llvm/trunk/test/tools/gold/X86/Inputs/type-merge.ll
llvm/trunk/test/tools/gold/X86/Inputs/type-merge2.ll
llvm/trunk/test/tools/gold/X86/alias2.ll
llvm/trunk/test/tools/gold/X86/available-externally.ll
llvm/trunk/test/tools/gold/X86/ctors.ll
llvm/trunk/test/tools/gold/X86/ctors2.ll
llvm/trunk/test/tools/gold/X86/drop-linkage.ll
llvm/trunk/test/tools/gold/X86/type-merge.ll
llvm/trunk/test/tools/gold/X86/type-merge2.ll
llvm/trunk/test/tools/gold/X86/unnamed-addr.ll
Added: llvm/trunk/test/tools/gold/X86/Inputs/ctors2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/Inputs/ctors2.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/Inputs/ctors2.ll (added)
+++ llvm/trunk/test/tools/gold/X86/Inputs/ctors2.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,5 @@
+ at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @bar, i8* null }]
+
+define void @bar() {
+ ret void
+}
Added: llvm/trunk/test/tools/gold/X86/Inputs/drop-linkage.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/Inputs/drop-linkage.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/Inputs/drop-linkage.ll (added)
+++ llvm/trunk/test/tools/gold/X86/Inputs/drop-linkage.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,9 @@
+$foo = comdat any
+define linkonce void @foo() comdat {
+ ret void
+}
+
+define void @bar() {
+ call void @foo()
+ ret void
+}
Added: llvm/trunk/test/tools/gold/X86/Inputs/type-merge.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/Inputs/type-merge.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/Inputs/type-merge.ll (added)
+++ llvm/trunk/test/tools/gold/X86/Inputs/type-merge.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,5 @@
+define void @zed() {
+ call void @bar()
+ ret void
+}
+declare void @bar()
Added: llvm/trunk/test/tools/gold/X86/Inputs/type-merge2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/Inputs/type-merge2.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/Inputs/type-merge2.ll (added)
+++ llvm/trunk/test/tools/gold/X86/Inputs/type-merge2.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,5 @@
+%zed = type { i16 }
+define void @bar(%zed* %this) {
+ store %zed* %this, %zed** null
+ ret void
+}
Added: llvm/trunk/test/tools/gold/X86/alias2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/alias2.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/alias2.ll (added)
+++ llvm/trunk/test/tools/gold/X86/alias2.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,23 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -shared -o %t2.bc -plugin %llvmshlibdir/LLVMgold.so %t.o -plugin-opt=emit-llvm
+; RUN: llvm-dis %t2.bc -o - | FileCheck %s
+
+ at bar = alias void (), void ()* @zed
+define void @foo() {
+ call void @bar()
+ ret void
+}
+define void @zed() {
+ ret void
+}
+
+; CHECK: @bar = alias void (), void ()* @zed
+
+; CHECK: define void @foo() {
+; CHECK-NEXT: call void @bar()
+; CHECK-NEXT: ret void
+; CHECK-NEXT: }
+
+; CHECK: define void @zed() {
+; CHECK-NEXT: ret void
+; CHECK-NEXT: }
Added: llvm/trunk/test/tools/gold/X86/available-externally.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/available-externally.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/available-externally.ll (added)
+++ llvm/trunk/test/tools/gold/X86/available-externally.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,16 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+define void @foo() {
+ call void @bar()
+ ret void
+}
+define available_externally void @bar() {
+ ret void
+}
+
+; CHECK: define available_externally void @bar() {
Added: llvm/trunk/test/tools/gold/X86/ctors.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/ctors.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/ctors.ll (added)
+++ llvm/trunk/test/tools/gold/X86/ctors.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,13 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+ at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo, i8* null }]
+
+define internal void @foo() {
+ ret void
+}
+
+; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo, i8* null }]
Added: llvm/trunk/test/tools/gold/X86/ctors2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/ctors2.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/ctors2.ll (added)
+++ llvm/trunk/test/tools/gold/X86/ctors2.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,14 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/ctors2.ll -o %t2.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+ at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo, i8* null }]
+
+define void @foo() {
+ ret void
+}
+
+; CHECK: @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @bar, i8* null }]
Added: llvm/trunk/test/tools/gold/X86/drop-linkage.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/drop-linkage.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/drop-linkage.ll (added)
+++ llvm/trunk/test/tools/gold/X86/drop-linkage.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,14 @@
+; RUN: llc %s -o %t.s
+; RUN: llvm-mc %t.s -o %t.o -filetype=obj
+; RUN: llvm-as %p/Inputs/drop-linkage.ll -o %t2.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+define void @foo() {
+ ret void
+}
+
+; CHECK: declare void @foo(){{$}}
Added: llvm/trunk/test/tools/gold/X86/type-merge.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/type-merge.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/type-merge.ll (added)
+++ llvm/trunk/test/tools/gold/X86/type-merge.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,24 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/type-merge.ll -o %t2.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+define void @foo() {
+ call void @bar(i8* null)
+ ret void
+}
+declare void @bar(i8*)
+
+; CHECK: define void @foo() {
+; CHECK-NEXT: call void @bar(i8* null)
+; CHECK-NEXT: ret void
+; CHECK-NEXT: }
+
+; CHECK: declare void @bar(i8*)
+
+; CHECK: define void @zed() {
+; CHECK-NEXT: call void bitcast (void (i8*)* @bar to void ()*)()
+; CHECK-NEXT: ret void
+; CHECK-NEXT: }
Added: llvm/trunk/test/tools/gold/X86/type-merge2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/type-merge2.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/type-merge2.ll (added)
+++ llvm/trunk/test/tools/gold/X86/type-merge2.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,26 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/type-merge2.ll -o %t2.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+%zed = type { i8 }
+define void @foo() {
+ call void @bar(%zed* null)
+ ret void
+}
+declare void @bar(%zed*)
+
+; CHECK: %zed = type { i8 }
+; CHECK-NEXT: %zed.0 = type { i16 }
+
+; CHECK: define void @foo() {
+; CHECK-NEXT: call void bitcast (void (%zed.0*)* @bar to void (%zed*)*)(%zed* null)
+; CHECK-NEXT: ret void
+; CHECK-NEXT: }
+
+; CHECK: define void @bar(%zed.0* %this) {
+; CHECK-NEXT: store %zed.0* %this, %zed.0** null
+; CHECK-NEXT: ret void
+; CHECK-NEXT: }
Added: llvm/trunk/test/tools/gold/X86/unnamed-addr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/unnamed-addr.ll?rev=254174&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/unnamed-addr.ll (added)
+++ llvm/trunk/test/tools/gold/X86/unnamed-addr.ll Thu Nov 26 13:53:12 2015
@@ -0,0 +1,14 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+ at a = internal unnamed_addr constant i8 42
+
+define i8* @f() {
+ ret i8* @a
+}
+
+; CHECK: @a = internal unnamed_addr constant i8 42
More information about the llvm-commits
mailing list