1 ; RUN: opt -S -dxil-finalize-linkage -mtriple=dxil-unknown-shadermodel6.5-compute %s | FileCheck %s
2 ; RUN: llc %s --filetype=asm -o - | FileCheck %s --check-prefixes=CHECK-LLC
4 target triple = "dxilv1.5-pc-shadermodel6.5-compute"
6 ; DXILFinalizeLinkage changes linkage of all functions that are not
7 ; entry points or exported function to internal.
9 ; CHECK-NOT: define internal void @"?f1@@YAXXZ"()
10 define void @"?f1@@YAXXZ"() #0 {
15 ; CHECK: define internal void @"?f2@@YAXXZ"()
16 define void @"?f2@@YAXXZ"() #0 {
21 ; CHECK: define internal void @"?f3@@YAXXZ"()
22 define void @"?f3@@YAXXZ"() #0 {
27 ; CHECK: define internal void @"?foo@@YAXXZ"()
28 define void @"?foo@@YAXXZ"() #0 {
30 call void @"?f2@@YAXXZ"() #3
34 ; Exported function - do not change linkage
35 ; CHECK: define void @"?bar@@YAXXZ"()
36 define void @"?bar@@YAXXZ"() #1 {
38 call void @"?f3@@YAXXZ"() #3
42 ; CHECK: define internal void @"?main@@YAXXZ"() #0
43 define internal void @"?main@@YAXXZ"() #0 {
45 call void @"?foo@@YAXXZ"() #3
46 call void @"?bar@@YAXXZ"() #3
50 ; Entry point function - do not change linkage
51 ; CHECK: define void @main() #2
52 define void @main() #2 {
54 call void @"?main@@YAXXZ"()
58 attributes #0 = { convergent noinline nounwind optnone}
59 attributes #1 = { convergent noinline nounwind optnone "hlsl.export"}
60 attributes #2 = { convergent "hlsl.numthreads"="4,1,1" "hlsl.shader"="compute"}
61 attributes #3 = { convergent }
63 ; Make sure "hlsl.export" attribute is stripped by llc
64 ; CHECK-LLC-NOT: "hlsl.export"