[opaque pointer type] Add textual IR support for explicit type parameter for global...
[oota-llvm.git] / test / Other / extract-alias.ll
1 ; RUN: llvm-extract -func foo -S < %s | FileCheck %s
2 ; RUN: llvm-extract -delete -func foo -S < %s | FileCheck --check-prefix=DELETE %s
3 ; RUN: llvm-extract -alias zeda0 -S < %s | FileCheck --check-prefix=ALIAS %s
4 ; RUN: llvm-extract -ralias '.*bar' -S < %s | FileCheck --check-prefix=ALIASRE %s
5
6 ; Both aliases should be converted to declarations
7 ; CHECK:      @zeda0 = external global i32
8 ; CHECK:      define i32* @foo() {
9 ; CHECK-NEXT:  call void @a0bar()
10 ; CHECK-NEXT:  ret i32* @zeda0
11 ; CHECK-NEXT: }
12 ; CHECK:      declare void @a0bar()
13
14 ; DELETE:      @zed = global i32 0
15 ; DELETE:      @zeda0 = alias i32, i32* @zed
16 ; DELETE-NEXT: @a0foo = alias i32* (), i32* ()* @foo
17 ; DELETE-NEXT: @a0a0bar = alias void (), void ()* @bar
18 ; DELETE-NEXT: @a0bar = alias void (), void ()* @bar
19 ; DELETE:      declare i32* @foo()
20 ; DELETE:      define void @bar() {
21 ; DELETE-NEXT:  %c = call i32* @foo()
22 ; DELETE-NEXT:  ret void
23 ; DELETE-NEXT: }
24
25 ; ALIAS: @zed = external global i32
26 ; ALIAS: @zeda0 = alias i32, i32* @zed
27
28 ; ALIASRE: @a0a0bar = alias void (), void ()* @bar
29 ; ALIASRE: @a0bar = alias void (), void ()* @bar
30 ; ALIASRE: declare void @bar()
31
32 @zed = global i32 0
33 @zeda0 = alias i32, i32* @zed
34
35 @a0foo = alias i32* (), i32* ()* @foo
36
37 define i32* @foo() {
38   call void @a0bar()
39   ret i32* @zeda0
40 }
41
42 @a0a0bar = alias void (), void ()* @bar
43
44 @a0bar = alias void (), void ()* @bar
45
46 define void @bar() {
47   %c = call i32* @foo()
48   ret void
49 }