33 lines · plain
1; RUN: opt -S -dxil-forward-handle-accesses -mtriple=dxil--shadermodel6.3-library %s | FileCheck %s2 3%__cblayout_CB = type <{ float, i32, i32 }>4%__cblayout_CB2 = type <{ float }>5%struct.Scalars = type { float, i32, i32 }6 7@CB.cb = local_unnamed_addr global target("dx.CBuffer", %__cblayout_CB) poison8@CB2.cb = local_unnamed_addr global target("dx.CBuffer", %__cblayout_CB2) poison9 10define void @main() local_unnamed_addr #1 {11entry:12 ; CHECK: [[CB:%.*]] = tail call target({{.*}}) @llvm.dx.resource.handlefrombinding13 %h = tail call target("dx.CBuffer", %__cblayout_CB) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)14 store target("dx.CBuffer", %__cblayout_CB) %h, ptr @CB.cb, align 415 %_ZL3Out_h.i.i = tail call target("dx.RawBuffer", %struct.Scalars, 1, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)16 ; CHECK-NOT: load target({{.*}}), ptr @CB.cb17 %cb = load target("dx.CBuffer", %__cblayout_CB), ptr @CB.cb, align 418 ; CHECK: call { float, float, float, float } @llvm.dx.resource.load.cbufferrow.4.{{.*}}(target({{.*}}) [[CB]], i32 0)19 %0 = call { float, float, float, float } @llvm.dx.resource.load.cbufferrow.4(target("dx.CBuffer", %__cblayout_CB) %cb, i32 0)20 %1 = extractvalue { float, float, float, float } %0, 021 call void @llvm.dx.resource.store.rawbuffer(target("dx.RawBuffer", %struct.Scalars, 1, 0) %_ZL3Out_h.i.i, i32 0, i32 0, float %1)22 23 ; CHECK: [[CB2:%.*]] = tail call target({{.*}}) @llvm.dx.resource.handlefromimplicitbinding24 %h2 = tail call target("dx.CBuffer", %__cblayout_CB2) @llvm.dx.resource.handlefromimplicitbinding(i32 100, i32 0, i32 1, i32 0, ptr null)25 store target("dx.CBuffer", %__cblayout_CB2) %h2, ptr @CB2.cb, align 426 ; CHECK-NOT: load target({{.*}}), ptr @CB2.cb27 %cb2 = load target("dx.CBuffer", %__cblayout_CB2), ptr @CB2.cb, align 428 29 ret void30}31 32attributes #0 = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: none) "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }33