Files
clang-p2996/clang/test/CodeGenHLSL/GlobalConstructorLib.hlsl
Xiang Li 2bdfececef [HLSL] Remove global ctor/dtor variable for non-lib profile.
After generated call for ctor/dtor for entry, global variable for ctor/dtor are useless.
Remove them for non-lib profiles.
Lib profile still need these in case export function used the global variable which require ctor/dtor.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D133993
2022-10-06 15:00:50 -07:00

24 lines
670 B
HLSL

// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -S -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s
// Make sure global variable for ctors exist for lib profile.
// CHECK:@llvm.global_ctors
RWBuffer<float> Buffer;
[shader("compute")]
[numthreads(1,1,1)]
void FirstEntry() {}
// CHECK: define void @FirstEntry()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @_GLOBAL__sub_I_GlobalConstructorLib.hlsl()
[shader("compute")]
[numthreads(1,1,1)]
void SecondEntry() {}
// CHECK: define void @SecondEntry()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @_GLOBAL__sub_I_GlobalConstructorLib.hlsl()
// CHECK-NEXT: call void @"?SecondEntry@@YAXXZ"()