40 lines · plain
1; Use llc for this test so that we don't abort after the first error.2; RUN: not llc %s -o /dev/null 2>&1 | FileCheck %s3 4; Check multiple overlap errors.5 6; A overlaps with B7; B overlaps with C8; StructuredBuffer<float> A[5] : register(t1, space11); // 1-59; StructuredBuffer<float> B[6] : register(t2, space11); // 2-710; StructuredBuffer<float> C[3] : register(t6, space11); // 6-8 11 12; CHECK: error: resource A at register 1 overlaps with resource B at register 2 in space 1113; CHECK: error: resource B at register 2 overlaps with resource C at register 6 in space 1114 15target triple = "dxil-pc-shadermodel6.3-library"16 17@A.str = private unnamed_addr constant [2 x i8] c"A\00", align 118@B.str = private unnamed_addr constant [2 x i8] c"B\00", align 119@C.str = private unnamed_addr constant [2 x i8] c"C\00", align 120 21; Fake globals to store handles in; this is to make sure the handlefrombinding calls22; are not optimized away by llc.23@One = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 424@Two = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 425@Three = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 426 27define void @test_overlapping() "hlsl.export" {28entry:29 %h1 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 11, i32 1, i32 5, i32 0, ptr @A.str)30 store target("dx.RawBuffer", float, 0, 0) %h1, ptr @One, align 431 32 %h2 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 11, i32 2, i32 6, i32 0, ptr @B.str)33 store target("dx.RawBuffer", float, 0, 0) %h2, ptr @Two, align 434 35 %h3 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 11, i32 6, i32 3, i32 4, ptr @C.str)36 store target("dx.RawBuffer", float, 0, 0) %h3, ptr @Three, align 437 38 ret void39}40