[WebAssembly] Use inline target tripple in test cases

This is somewhat preferable since (in many cases) it allows llc
to be run directly on the .ll files without having to pass the
`-mtriple` argument.

Differential Revision: https://reviews.llvm.org/D42438

llvm-svn: 323299
This commit is contained in:
Sam Clegg 2018-01-24 03:29:47 +00:00
parent ffb4fb7f6f
commit 70683b2f75
47 changed files with 133 additions and 51 deletions

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
declare i32 @bar() local_unnamed_addr #1
define i32 @foo() local_unnamed_addr #0 {

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
declare i32 @foo() local_unnamed_addr #1
define i32 @bar() local_unnamed_addr #0 {

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
@indirect_bar = internal local_unnamed_addr global i64 ()* @bar, align 4
@indirect_foo = internal local_unnamed_addr global i32 ()* @foo, align 4

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
$inlineFn = comdat any
@constantData = weak_odr constant [3 x i8] c"abc", comdat($inlineFn)
define linkonce_odr i32 @inlineFn() comdat {

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
$inlineFn = comdat any
@constantData = weak_odr constant [3 x i8] c"abc", comdat($inlineFn)
define linkonce_odr i32 @inlineFn() comdat {

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
define hidden void @myctor() {
entry:
ret void

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
; Wasm module generated from the following C code:
; void puts(const char*);
; void hello() { puts("hello\n"); }

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
; Function Attrs: norecurse nounwind readnone
define hidden i32 @archiveHidden() #0 {
entry:

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
; Will collide: local (internal linkage) with global (external) linkage
@colliding_global1 = internal default global i32 0, align 4
; Will collide: global with local

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
; Will collide: local (internal linkage) with global (external) linkage
@colliding_global1 = default global i32 0, align 4
; Will collide: global with local

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
@g0 = global i32 1, align 4
@foo = global i32 1, align 4

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
; Function Attrs: norecurse nounwind readnone
define i32 @ret32(float %arg) #0 {
entry:

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
define i64 @ret64(double %arg) local_unnamed_addr #0 {
entry:
ret i64 1

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
; Function Attrs: norecurse nounwind readnone
define i32 @direct_fn() #0 {
entry:

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
define weak i32 @weakFn() #0 {
entry:
ret i32 1

View File

@ -1,3 +1,5 @@
target triple = "wasm32-unknown-unknown-wasm"
define weak i32 @weakFn() #0 {
entry:
ret i32 2

View File

@ -1,7 +1,9 @@
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj -o %t.o %s
; RUN: lld -flavor wasm %t.o -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
@start_alias = alias i32 (), i32 ()* @_start
; Function Attrs: nounwind uwtable

View File

@ -1,7 +1,7 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/archive1.ll -o %t.a1.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/archive2.ll -o %t.a2.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/hello.ll -o %t.a3.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: llc -filetype=obj %S/Inputs/archive1.ll -o %t.a1.o
; RUN: llc -filetype=obj %S/Inputs/archive2.ll -o %t.a2.o
; RUN: llc -filetype=obj %S/Inputs/hello.ll -o %t.a3.o
; RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o %t.a3.o
; RUN: rm -f %t.imports
; RUN: not lld -flavor wasm %t.a %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED %s
@ -13,6 +13,8 @@
; RUN: llvm-nm -a %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
declare i32 @foo() local_unnamed_addr #1
declare i32 @missing_func() local_unnamed_addr #1

View File

@ -1,5 +1,5 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/call-indirect.ll -o %t2.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %p/Inputs/call-indirect.ll -o %t2.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm -o %t.wasm %t2.o %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
@ -8,6 +8,8 @@
; int (*indirect_func)(void) = &foo;
; void _start(void) { indirect_func(); }
target triple = "wasm32-unknown-unknown-wasm"
@indirect_func = local_unnamed_addr global i32 ()* @foo, align 4
; Function Attrs: norecurse nounwind readnone

View File

@ -4,6 +4,8 @@
; RUN: lld -flavor wasm -o %t.wasm %t.o %t1.o %t2.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
declare i32 @inlineFn()
define void @_start() local_unnamed_addr {

View File

@ -1,4 +1,4 @@
# RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
# RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
# RUN: not lld -flavor wasm -o %t.wasm %t.ret32.o %t.ret32.o 2>&1 | FileCheck %s
# CHECK: duplicate symbol: ret32

View File

@ -1,5 +1,7 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/hello.ll -o %t.hello.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.o
; RUN: llc -filetype=obj %s -o %t.o
target triple = "wasm32-unknown-unknown-wasm"
@foo = hidden global i32 1, align 4
@aligned_bar = hidden global i32 3, align 16

View File

@ -1,4 +1,6 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %s -o %t.o
target triple = "wasm32-unknown-unknown-wasm"
define hidden void @entry() local_unnamed_addr #0 {
entry:

View File

@ -1,8 +1,10 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: not lld -flavor wasm --export=missing -o %t.wasm %t.o 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s
; RUN: lld -flavor wasm --export=hidden_function -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
define hidden i32 @hidden_function() local_unnamed_addr {
entry:
ret i32 0

View File

@ -1,8 +1,10 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm -o %t.wasm %t.o %t.ret32.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
; Function Attrs: nounwind
define hidden void @_start() local_unnamed_addr #0 {
entry:

View File

@ -1,8 +1,10 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm -o %t.wasm %t.ret32.o %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
; Function Attrs: nounwind
define hidden void @_start() local_unnamed_addr #0 {
entry:

View File

@ -1,5 +1,5 @@
# RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
# RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret64.ll -o %t.ret64.o
# RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
# RUN: llc -filetype=obj %p/Inputs/ret64.ll -o %t.ret64.o
# RUN: lld -flavor wasm -r -o %t.wasm %t.ret32.o %t.ret64.o
# RUN: obj2yaml %t.wasm | FileCheck %s

View File

@ -1,4 +1,4 @@
# RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
# RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
# RUN: lld -flavor wasm -entry ret32 --import-memory -o %t.wasm %t.ret32.o
# RUN: obj2yaml %t.wasm | FileCheck %s

View File

@ -1,5 +1,7 @@
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %S/Inputs/global-ctor-dtor.ll -o %t.global-ctor-dtor.o
; RUN: llc -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj %S/Inputs/global-ctor-dtor.ll -o %t.global-ctor-dtor.o
target triple = "wasm32-unknown-unknown-wasm"
define hidden void @func1() {
entry:

View File

@ -1,6 +1,8 @@
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %s -o %t.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: not lld -flavor wasm -o %t.wasm -z stack-size=1 %t.o 2>&1 | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
define i32 @_start() local_unnamed_addr #1 {
entry:
ret i32 0

View File

@ -1,13 +1,15 @@
; Verify that the -u / --undefined option is able to pull in symbols from
; an archive, and doesn't error when uses to pull in a symbol already loaded.
;
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/ret64.ll -o %t.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/ret32.ll -o %t2.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t3.o
; RUN: llc -filetype=obj %S/Inputs/ret64.ll -o %t.o
; RUN: llc -filetype=obj %S/Inputs/ret32.ll -o %t2.o
; RUN: llc -filetype=obj %s -o %t3.o
; RUN: llvm-ar rcs %t2.a %t2.o
; RUN: lld -flavor wasm %t3.o %t2.a %t.o -o %t.wasm -u ret32 --undefined ret64
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
define i32 @_start() local_unnamed_addr {
entry:
ret i32 1

View File

@ -1,7 +1,9 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
@foo = default global i32 1, align 4
@bar = internal default global i32 3, align 4

View File

@ -1,5 +1,5 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/locals-duplicate1.ll -o %t1.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/locals-duplicate2.ll -o %t2.o
; RUN: llc -filetype=obj %p/Inputs/locals-duplicate1.ll -o %t1.o
; RUN: llc -filetype=obj %p/Inputs/locals-duplicate2.ll -o %t2.o
; RUN: lld -flavor wasm --no-entry -o %t.wasm %t1.o %t2.o
; RUN: obj2yaml %t.wasm | FileCheck %s

View File

@ -1,5 +1,5 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/many-funcs.ll -o %t.many.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %p/Inputs/many-funcs.ll -o %t.many.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm -r -o %t.wasm %t.many.o %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
@ -8,6 +8,8 @@
; 128 function and so the final output requires a 2-byte LEB in
; the CODE section header to store the function count.
target triple = "wasm32-unknown-unknown-wasm"
define i32 @func() {
entry:
%call = tail call i32 @func()

View File

@ -1,8 +1,10 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/hello.ll -o %t.hello.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm -r -o %t.wasm %t.hello.o %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
; Function Attrs: nounwind
define hidden i32 @my_func() local_unnamed_addr {
entry:

View File

@ -1,7 +1,9 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.main.o
; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: llc -filetype=obj %s -o %t.main.o
; RUN: not lld -flavor wasm --check-signatures -o %t.wasm %t.main.o %t.ret32.o 2>&1 | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
; Function Attrs: nounwind
define hidden void @_start() local_unnamed_addr #0 {
entry:

View File

@ -1,7 +1,9 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm --relocatable -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
; Function Attrs: nounwind
define i32 @_start() local_unnamed_addr {
entry:

View File

@ -1,4 +1,4 @@
RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
RUN: lld -flavor wasm --strip-debug --entry=ret32 -o %t.wasm %t.ret32.o
RUN: obj2yaml %t.wasm | FileCheck %s

View File

@ -1,7 +1,9 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
; RUN: not lld -flavor wasm -o %t.wasm %t.o %t.ret32.o 2>&1 | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
@ret32 = extern_weak global i32, align 4
; CHECK: error: symbol type mismatch: ret32

View File

@ -1,4 +1,4 @@
RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o
RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
RUN: not lld -flavor wasm -o %t.wasm %t.ret32.o 2>&1 | FileCheck %s
CHECK: error: undefined symbol: _start

View File

@ -1,4 +1,4 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm --allow-undefined -o %t.wasm %t.o
; Fails due to undefined 'foo'
@ -9,6 +9,8 @@
; RUN: echo 'foo' > %t.txt
; RUN: lld -flavor wasm --allow-undefined-file=%t.txt -o %t.wasm %t.o
target triple = "wasm32-unknown-unknown-wasm"
; Takes the address of the external foo() resulting in undefined external
@bar = hidden local_unnamed_addr global i8* bitcast (i32 ()* @foo to i8*), align 4

View File

@ -1,7 +1,9 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm -o %t.wasm %t.o
; RUN: llvm-readobj -file-headers %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
define hidden void @_start() local_unnamed_addr #0 {
entry:
ret void

View File

@ -1,5 +1,5 @@
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %S/Inputs/hidden.ll -o %t2.o
; RUN: llc -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj %S/Inputs/hidden.ll -o %t2.o
; RUN: llvm-ar rcs %t2.a %t2.o
; RUN: lld -flavor wasm %t.o %t2.a -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s
@ -7,6 +7,8 @@
; Test that hidden symbols are not exported, whether pulled in from an archive
; or directly.
target triple = "wasm32-unknown-unknown-wasm"
define hidden i32 @objectHidden() {
entry:
ret i32 0

View File

@ -1,11 +1,13 @@
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
; RUN: llc -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
; RUN: lld -flavor wasm %t.o %t2.o -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s
; Test that the strongly defined alias_fn from this file is used both here
; and in call_alias.
target triple = "wasm32-unknown-unknown-wasm"
define i32 @alias_fn() local_unnamed_addr #1 {
ret i32 1
}

View File

@ -1,10 +1,12 @@
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
; RUN: llc -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
; RUN: lld -flavor wasm %t.o %t2.o -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s
; Test that weak aliases (alias_fn is a weak alias of direct_fn) are linked correctly
target triple = "wasm32-unknown-unknown-wasm"
declare i32 @alias_fn() local_unnamed_addr #1
; Function Attrs: nounwind uwtable

View File

@ -1,9 +1,11 @@
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/weak-symbol1.ll -o %t1.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/weak-symbol2.ll -o %t2.o
; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o
; RUN: llc -filetype=obj %p/Inputs/weak-symbol1.ll -o %t1.o
; RUN: llc -filetype=obj %p/Inputs/weak-symbol2.ll -o %t2.o
; RUN: llc -filetype=obj %s -o %t.o
; RUN: lld -flavor wasm -o %t.wasm %t.o %t1.o %t2.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown-wasm"
declare i32 @weakFn() local_unnamed_addr
@weakGlobal = external global i32

View File

@ -1,10 +1,12 @@
; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s
; RUN: llc -filetype=obj -o %t.o %s
; RUN: lld -flavor wasm -strip-debug %t.o -o %t.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s
; Test that undefined weak externals (global_var) and (foo) don't cause
; link failures and resolve to zero.
target triple = "wasm32-unknown-unknown-wasm"
@global_var = extern_weak global i32, align 4
declare extern_weak i32 @foo()