|
1 | | -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s --check-prefixes=CS,NOINLINE,CHECK |
2 | | -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl202x -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s --check-prefixes=LIB,NOINLINE,CHECK |
3 | | -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -emit-llvm -O0 %s -o - | FileCheck %s --check-prefixes=INLINE,CHECK |
4 | | -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl202x -emit-llvm -O0 %s -o - | FileCheck %s --check-prefixes=INLINE,CHECK |
| 1 | +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s --check-prefixes=CS,CHECK |
| 2 | +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl202x -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s --check-prefixes=LIB,CHECK |
5 | 3 |
|
6 | | -// Tests that constructors and destructors are appropriately generated for globals |
7 | | -// and that their calls are inlined when AlwaysInline is run |
8 | | -// but global variables are retained for the library profiles |
9 | | - |
10 | | -// Make sure global variable for ctors/dtors exist for lib profile. |
11 | | -// LIB:@llvm.global_ctors |
| 4 | +// Make sure global variable for dtors exist for lib profile. |
12 | 5 | // LIB:@llvm.global_dtors |
13 | | -// Make sure global variable for ctors/dtors removed for compute profile. |
14 | | -// CS-NOT:@llvm.global_ctors |
15 | | -// CS-NOT:@llvm.global_dtors |
| 6 | +// Make sure global variable for dtors removed for compute profile. |
| 7 | +// CS-NOT:llvm.global_dtors |
16 | 8 |
|
17 | 9 | struct Tail { |
18 | 10 | Tail() { |
@@ -54,25 +46,22 @@ void main(unsigned GI : SV_GroupIndex) { |
54 | 46 | Wag(); |
55 | 47 | } |
56 | 48 |
|
57 | | -// CHECK: define void @main() |
58 | | -// CHECK-NEXT: entry: |
59 | | -// Verify destructor is emitted |
60 | | -// NOINLINE-NEXT: call void @_GLOBAL__sub_I_GlobalDestructors.hlsl() |
61 | | -// NOINLINE-NEXT: %0 = call i32 @llvm.dx.flattened.thread.id.in.group() |
62 | | -// NOINLINE-NEXT: call void @"?main@@YAXI@Z"(i32 %0) |
63 | | -// NOINLINE-NEXT: call void @_GLOBAL__D_a() |
64 | | -// NOINLINE-NEXT: ret void |
65 | | -// Verify inlining leaves only calls to "llvm." intrinsics |
66 | | -// INLINE-NOT: call {{[^@]*}} @{{[^l][^l][^v][^m][^\.]}} |
67 | | -// INLINE: ret void |
| 49 | +// Make sure global variable for ctors/dtors removed. |
| 50 | +// CHECK-NOT:@llvm.global_ctors |
| 51 | +// CHECK-NOT:@llvm.global_dtors |
| 52 | +//CHECK: define void @main() |
| 53 | +//CHECK-NEXT: entry: |
| 54 | +//CHECK-NEXT: call void @_GLOBAL__sub_I_GlobalDestructors.hlsl() |
| 55 | +//CHECK-NEXT: %0 = call i32 @llvm.dx.flattened.thread.id.in.group() |
| 56 | +//CHECK-NEXT: call void @"?main@@YAXI@Z"(i32 %0) |
| 57 | +//CHECK-NEXT: call void @_GLOBAL__D_a() |
| 58 | +//CHECK-NEXT: ret void |
68 | 59 |
|
69 | 60 | // This is really just a sanity check I needed for myself to verify that |
70 | 61 | // function scope static variables also get destroyed properly. |
71 | 62 |
|
72 | | -// NOINLINE: define internal void @_GLOBAL__D_a() [[IntAttr:\#[0-9]+]] |
73 | | -// NOINLINE-NEXT: entry: |
74 | | -// NOINLINE-NEXT: call void @"??1Tail@@QAA@XZ"(ptr @"?T@?1??Wag@@YAXXZ@4UTail@@A") |
75 | | -// NOINLINE-NEXT: call void @"??1Pupper@@QAA@XZ"(ptr @"?GlobalPup@@3UPupper@@A") |
76 | | -// NOINLINE-NEXT: ret void |
77 | | - |
78 | | -// NOINLINE: attributes [[IntAttr]] = {{.*}} alwaysinline |
| 63 | +//CHECK: define internal void @_GLOBAL__D_a() |
| 64 | +//CHECK-NEXT: entry: |
| 65 | +//CHECK-NEXT: call void @"??1Tail@@QAA@XZ"(ptr @"?T@?1??Wag@@YAXXZ@4UTail@@A") |
| 66 | +//CHECK-NEXT: call void @"??1Pupper@@QAA@XZ"(ptr @"?GlobalPup@@3UPupper@@A") |
| 67 | +//CHECK-NEXT: ret void |
0 commit comments