Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenHLSL / GlobalConstructorFunction.hlsl
blobd65dec4a1ddf4356aa05defd3b832810d7f61c16
1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -S -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s
3 int i;
5 __attribute__((constructor)) void call_me_first(void) {
6   i = 12;
9 __attribute__((constructor)) void then_call_me(void) {
10   i = 12;
13 __attribute__((destructor)) void call_me_last(void) {
14   i = 0;
17 [numthreads(1,1,1)]
18 void main(unsigned GI : SV_GroupIndex) {}
20 // Make sure global variable for ctors/dtors removed.
21 // CHECK-NOT:@llvm.global_ctors
22 // CHECK-NOT:@llvm.global_dtors
24 //CHECK: define void @main()
25 //CHECK-NEXT: entry:
26 //CHECK-NEXT:   call void @"?call_me_first@@YAXXZ"()
27 //CHECK-NEXT:   call void @"?then_call_me@@YAXXZ"()
28 //CHECK-NEXT:   %0 = call i32 @llvm.dx.flattened.thread.id.in.group()
29 //CHECK-NEXT:   call void @"?main@@YAXI@Z"(i32 %0)
30 //CHECK-NEXT:   call void @"?call_me_last@@YAXXZ"(
31 //CHECK-NEXT:   ret void