brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 0ef4b43 Raw
52 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -emit-llvm -disable-llvm-passes %s -o - | llvm-cxxfilt | FileCheck %s --check-prefixes=CHECK,NOINLINE2// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -emit-llvm -O0 %s -o - | llvm-cxxfilt | FileCheck %s --check-prefixes=CHECK,INLINE3 4// Make sure global variable for ctors exist for lib profile.5// CHECK:@llvm.global_ctors6 7RWBuffer<float> Buffer;8 9[shader("compute")]10[numthreads(1,1,1)]11void FirstEntry() {}12 13// CHECK: define void @FirstEntry()14// CHECK-NEXT: entry:15// NOINLINE-NEXT:   call void @_GLOBAL__sub_I_GlobalConstructorLib.hlsl()16// NOINLINE-NEXT:   call void @FirstEntry()17// Verify inlining leaves only calls to "llvm." intrinsics18// INLINE-NOT:   call {{[^@]*}} @{{[^l][^l][^v][^m][^\.]}}19// CHECK: ret void20 21[shader("compute")]22[numthreads(1,1,1)]23void SecondEntry() {}24 25// CHECK: define void @SecondEntry()26// CHECK-NEXT: entry:27// NOINLINE-NEXT:   call void @_GLOBAL__sub_I_GlobalConstructorLib.hlsl()28// NOINLINE-NEXT:   call void @SecondEntry()29// Verify inlining leaves only calls to "llvm." intrinsics30// INLINE-NOT:   call {{[^@]*}} @{{[^l][^l][^v][^m][^\.]}}31// CHECK: ret void32 33 34// Verify the constructors are alwaysinline35// NOINLINE: ; Function Attrs: {{.*}}alwaysinline36// NOINLINE-NEXT: define linkonce_odr hidden void @hlsl::RWBuffer<float>::RWBuffer()({{.*}}){{.*}} [[CtorAttr:\#[0-9]+]]37 38// NOINLINE: ; Function Attrs: {{.*}}alwaysinline39// NOINLINE-NEXT: define linkonce_odr hidden void @hlsl::RWBuffer<float>::RWBuffer(hlsl::RWBuffer<float> const&)({{.*}}){{.*}} [[CtorAttr]]40 41// NOINLINE: ; Function Attrs: {{.*}}alwaysinline42// NOINLINE-NEXT: define linkonce_odr hidden void @hlsl::RWBuffer<float>::RWBuffer()(ptr noundef nonnull align 4 dereferenceable(4) %this){{.*}} [[CtorAttr:\#[0-9]+]]43 44// NOINLINE: ; Function Attrs: {{.*}}alwaysinline45// NOINLINE-NEXT: define linkonce_odr hidden void @hlsl::RWBuffer<float>::RWBuffer(hlsl::RWBuffer<float> const&)({{.*}}){{.*}} [[CtorAttr]]46 47// NOINLINE: ; Function Attrs: {{.*}}alwaysinline48// NOINLINE-NEXT: define internal void @_GLOBAL__sub_I_GlobalConstructorLib.hlsl() [[InitAttr:\#[0-9]+]]49 50// NOINLINE-DAG: attributes [[InitAttr]] = {{.*}} alwaysinline51// NOINLINE-DAG: attributes [[CtorAttr]] = {{.*}} alwaysinline52