diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:08:18 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:08:18 +0000 |
| commit | 5ca98fd98791947eba83a1ed3f2c8191ef7afa6c (patch) | |
| tree | f5944309621cee4fe0976be6f9ac619b7ebfc4c2 /test/Feature | |
| parent | 68bcb7db193e4bc81430063148253d30a791023e (diff) | |
Notes
Diffstat (limited to 'test/Feature')
| -rw-r--r-- | test/Feature/alias2.ll | 28 | ||||
| -rw-r--r-- | test/Feature/aliases.ll | 15 | ||||
| -rw-r--r-- | test/Feature/comdat.ll | 21 | ||||
| -rw-r--r-- | test/Feature/globalvars.ll | 2 | ||||
| -rw-r--r-- | test/Feature/instructions.ll | 2 | ||||
| -rw-r--r-- | test/Feature/intrinsic-noduplicate.ll | 9 | ||||
| -rw-r--r-- | test/Feature/intrinsics.ll | 5 | ||||
| -rw-r--r-- | test/Feature/linker_private_linkages.ll | 6 | ||||
| -rw-r--r-- | test/Feature/optnone-llc.ll | 54 | ||||
| -rw-r--r-- | test/Feature/optnone-opt.ll | 74 |
10 files changed, 204 insertions, 12 deletions
diff --git a/test/Feature/alias2.ll b/test/Feature/alias2.ll new file mode 100644 index 000000000000..73c874f2b9ee --- /dev/null +++ b/test/Feature/alias2.ll @@ -0,0 +1,28 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + +@v1 = global i32 0 +; CHECK: @v1 = global i32 0 + +@v2 = global [1 x i32] zeroinitializer +; CHECK: @v2 = global [1 x i32] zeroinitializer + +@v3 = global [2 x i16] zeroinitializer +; CHECK: @v3 = global [2 x i16] zeroinitializer + +@a1 = alias bitcast (i32* @v1 to i16*) +; CHECK: @a1 = alias bitcast (i32* @v1 to i16*) + +@a2 = alias bitcast([1 x i32]* @v2 to i32*) +; CHECK: @a2 = alias getelementptr inbounds ([1 x i32]* @v2, i32 0, i32 0) + +@a3 = alias addrspacecast (i32* @v1 to i32 addrspace(2)*) +; CHECK: @a3 = alias addrspacecast (i32* @v1 to i32 addrspace(2)*) + +@a4 = alias bitcast (i32* @v1 to i16*) +; CHECK: @a4 = alias bitcast (i32* @v1 to i16*) + +@a5 = thread_local(localdynamic) alias i32* @v1 +; CHECK: @a5 = thread_local(localdynamic) alias i32* @v1 + +@a6 = alias getelementptr ([2 x i16]* @v3, i32 1, i32 1) +; CHECK: @a6 = alias getelementptr ([2 x i16]* @v3, i32 1, i32 1) diff --git a/test/Feature/aliases.ll b/test/Feature/aliases.ll index 139381215ee8..ad1d1b08901c 100644 --- a/test/Feature/aliases.ll +++ b/test/Feature/aliases.ll @@ -4,15 +4,24 @@ @llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @foo1 to i8*)], section "llvm.metadata" -@bar = external global i32 +@bar = global i32 0 @foo1 = alias i32* @bar @foo2 = alias i32* @bar @foo3 = alias i32* @foo2 +@foo4 = unnamed_addr alias i32* @foo2 + +; Make sure the verifier does not complain about references to a global +; declaration from an initializer. +@decl = external global i32 +@ptr = global i32* @decl +@ptr_a = alias i32** @ptr %FunTy = type i32() -declare i32 @foo_f() -@bar_f = alias weak %FunTy* @foo_f +define i32 @foo_f() { + ret i32 0 +} +@bar_f = alias weak_odr %FunTy* @foo_f @bar_ff = alias i32()* @bar_f @bar_i = alias internal i32* @bar diff --git a/test/Feature/comdat.ll b/test/Feature/comdat.ll new file mode 100644 index 000000000000..1e878bb71cd1 --- /dev/null +++ b/test/Feature/comdat.ll @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + +$f = comdat any +; CHECK: $f = comdat any + +$f2 = comdat any +; CHECK-NOT: f2 + +@v = global i32 0, comdat $f +; CHECK: @v = global i32 0, comdat $f + +@a = alias i32* @v +; CHECK: @a = alias i32* @v{{$}} + +define void @f() comdat $f { + ret void +} +; CHECK: define void @f() comdat $f + +$i = comdat largest +@i = internal global i32 0, comdat $i diff --git a/test/Feature/globalvars.ll b/test/Feature/globalvars.ll index dad1cf31d5e6..84b4bdfd3750 100644 --- a/test/Feature/globalvars.ll +++ b/test/Feature/globalvars.ll @@ -16,3 +16,5 @@ define i32 @foo(i32 %blah) { ret i32 %blah } +hidden dllexport global i32 42 +dllexport global i32 42 diff --git a/test/Feature/instructions.ll b/test/Feature/instructions.ll index d0c303d71914..aa962948a168 100644 --- a/test/Feature/instructions.ll +++ b/test/Feature/instructions.ll @@ -4,11 +4,13 @@ define i32 @test_extractelement(<4 x i32> %V) { %R = extractelement <4 x i32> %V, i32 1 ; <i32> [#uses=1] + %S = extractelement <4 x i32> %V, i64 1 ; <i32> [#uses=0] ret i32 %R } define <4 x i32> @test_insertelement(<4 x i32> %V) { %R = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1] + %S = insertelement <4 x i32> %V, i32 0, i64 0 ; <<4 x i32>> [#uses=0] ret <4 x i32> %R } diff --git a/test/Feature/intrinsic-noduplicate.ll b/test/Feature/intrinsic-noduplicate.ll new file mode 100644 index 000000000000..9a2b0aba5bd4 --- /dev/null +++ b/test/Feature/intrinsic-noduplicate.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + +; Make sure LLVM knows about the noduplicate attribute on the +; llvm.cuda.syncthreads intrinsic. + +declare void @llvm.cuda.syncthreads() + +; CHECK: declare void @llvm.cuda.syncthreads() #[[ATTRNUM:[0-9]+]] +; CHECK: attributes #[[ATTRNUM]] = { noduplicate nounwind } diff --git a/test/Feature/intrinsics.ll b/test/Feature/intrinsics.ll index 28be053714d1..278cb9564e62 100644 --- a/test/Feature/intrinsics.ll +++ b/test/Feature/intrinsics.ll @@ -61,7 +61,7 @@ define void @libm() { ; FIXME: test ALL the intrinsics in this file. ; rdar://11542750 -; CHECK: declare void @llvm.trap() #2 +; CHECK: declare void @llvm.trap() #1 declare void @llvm.trap() define void @trap() { @@ -70,5 +70,4 @@ define void @trap() { } ; CHECK: attributes #0 = { nounwind readnone } -; CHECK: attributes #1 = { nounwind readonly } -; CHECK: attributes #2 = { noreturn nounwind } +; CHECK: attributes #1 = { noreturn nounwind } diff --git a/test/Feature/linker_private_linkages.ll b/test/Feature/linker_private_linkages.ll deleted file mode 100644 index 19bcbb40aa01..000000000000 --- a/test/Feature/linker_private_linkages.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: llvm-as < %s | llvm-dis > %t1.ll -; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll -; RUN: diff %t1.ll %t2.ll - -@foo = linker_private hidden global i32 0 -@bar = linker_private_weak hidden global i32 0 diff --git a/test/Feature/optnone-llc.ll b/test/Feature/optnone-llc.ll new file mode 100644 index 000000000000..6cb27d0b7d5c --- /dev/null +++ b/test/Feature/optnone-llc.ll @@ -0,0 +1,54 @@ +; RUN: llc -O0 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-O0 +; RUN: llc -O1 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox +; RUN: llc -O2 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox +; RUN: llc -O3 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox +; RUN: llc -misched-postra -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-MORE + +; REQUIRES: asserts + +; This test verifies that we don't run Machine Function optimizations +; on optnone functions. + +; Function Attrs: noinline optnone +define i32 @_Z3fooi(i32 %x) #0 { +entry: + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + br label %while.cond + +while.cond: ; preds = %while.body, %entry + %0 = load i32* %x.addr, align 4 + %dec = add nsw i32 %0, -1 + store i32 %dec, i32* %x.addr, align 4 + %tobool = icmp ne i32 %0, 0 + br i1 %tobool, label %while.body, label %while.end + +while.body: ; preds = %while.cond + br label %while.cond + +while.end: ; preds = %while.cond + ret i32 0 +} + +attributes #0 = { optnone noinline } + +; Nothing that runs at -O0 gets skipped. +; LLC-O0-NOT: Skipping pass + +; Machine Function passes run at -O1 and higher. +; LLC-Ox-DAG: Skipping pass 'Branch Probability Basic Block Placement' +; LLC-Ox-DAG: Skipping pass 'CodeGen Prepare' +; LLC-Ox-DAG: Skipping pass 'Control Flow Optimizer' +; LLC-Ox-DAG: Skipping pass 'Machine code sinking' +; LLC-Ox-DAG: Skipping pass 'Machine Common Subexpression Elimination' +; LLC-Ox-DAG: Skipping pass 'Machine Copy Propagation Pass' +; LLC-Ox-DAG: Skipping pass 'Machine Loop Invariant Code Motion' +; LLC-Ox-DAG: Skipping pass 'Merge disjoint stack slots' +; LLC-Ox-DAG: Skipping pass 'Optimize machine instruction PHIs' +; LLC-Ox-DAG: Skipping pass 'Peephole Optimizations' +; LLC-Ox-DAG: Skipping pass 'Post RA top-down list latency scheduler' +; LLC-Ox-DAG: Skipping pass 'Remove dead machine instructions' +; LLC-Ox-DAG: Skipping pass 'Tail Duplication' + +; Alternate post-RA scheduler. +; LLC-MORE: Skipping pass 'PostRA Machine Instruction Scheduler' diff --git a/test/Feature/optnone-opt.ll b/test/Feature/optnone-opt.ll new file mode 100644 index 000000000000..f83e68ccfef8 --- /dev/null +++ b/test/Feature/optnone-opt.ll @@ -0,0 +1,74 @@ +; RUN: opt -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O0 +; RUN: opt -O1 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 +; RUN: opt -O2 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3 +; RUN: opt -O3 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3 +; RUN: opt -bb-vectorize -dce -die -loweratomic -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-MORE +; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-LOOP + +; REQUIRES: asserts + +; This test verifies that we don't run target independent IR-level +; optimizations on optnone functions. + +; Function Attrs: noinline optnone +define i32 @_Z3fooi(i32 %x) #0 { +entry: + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + br label %while.cond + +while.cond: ; preds = %while.body, %entry + %0 = load i32* %x.addr, align 4 + %dec = add nsw i32 %0, -1 + store i32 %dec, i32* %x.addr, align 4 + %tobool = icmp ne i32 %0, 0 + br i1 %tobool, label %while.body, label %while.end + +while.body: ; preds = %while.cond + br label %while.cond + +while.end: ; preds = %while.cond + ret i32 0 +} + +attributes #0 = { optnone noinline } + +; Nothing that runs at -O0 gets skipped. +; OPT-O0-NOT: Skipping pass + +; IR passes run at -O1 and higher. +; OPT-O1-DAG: Skipping pass 'Aggressive Dead Code Elimination' +; OPT-O1-DAG: Skipping pass 'Combine redundant instructions' +; OPT-O1-DAG: Skipping pass 'Dead Store Elimination' +; OPT-O1-DAG: Skipping pass 'Early CSE' +; OPT-O1-DAG: Skipping pass 'Jump Threading' +; OPT-O1-DAG: Skipping pass 'MemCpy Optimization' +; OPT-O1-DAG: Skipping pass 'Reassociate expressions' +; OPT-O1-DAG: Skipping pass 'Simplify the CFG' +; OPT-O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation' +; OPT-O1-DAG: Skipping pass 'SROA' +; OPT-O1-DAG: Skipping pass 'Tail Call Elimination' +; OPT-O1-DAG: Skipping pass 'Value Propagation' + +; Additional IR passes run at -O2 and higher. +; OPT-O2O3-DAG: Skipping pass 'Global Value Numbering' +; OPT-O2O3-DAG: Skipping pass 'SLP Vectorizer' + +; Additional IR passes that opt doesn't turn on by default. +; OPT-MORE-DAG: Skipping pass 'Basic-Block Vectorization' +; OPT-MORE-DAG: Skipping pass 'Dead Code Elimination' +; OPT-MORE-DAG: Skipping pass 'Dead Instruction Elimination' +; OPT-MORE-DAG: Skipping pass 'Lower atomic intrinsics + +; Loop IR passes that opt doesn't turn on by default. +; OPT-LOOP-DAG: Skipping pass 'Delete dead loops' +; OPT-LOOP-DAG: Skipping pass 'Extract loops into new functions' +; OPT-LOOP-DAG: Skipping pass 'Induction Variable Simplification' +; OPT-LOOP-DAG: Skipping pass 'Loop Invariant Code Motion' +; OPT-LOOP-DAG: Skipping pass 'Loop Strength Reduction' +; OPT-LOOP-DAG: Skipping pass 'Recognize loop idioms' +; OPT-LOOP-DAG: Skipping pass 'Reroll loops' +; OPT-LOOP-DAG: Skipping pass 'Rotate Loops' +; OPT-LOOP-DAG: Skipping pass 'Simplify instructions in loops' +; OPT-LOOP-DAG: Skipping pass 'Unroll loops' +; OPT-LOOP-DAG: Skipping pass 'Unswitch loops' |
