Helena Kotas 8eadbea8e3
[HLSL] Diagnose overlapping resource bindings (#140982)
Adds reporting of overlapping binding errors to `DXILPostOptimizationValidation` pass. Only runs when `DXILResourceBindingAnalysis` detects that there is a resource binding that overlaps while it is building up a map of available register spaces.

Fixes #110723
2025-05-30 13:22:25 -07:00

20 lines
834 B
LLVM

; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
; Check overlap error for two resource arrays.
; A overlaps with B
; RWBuffer<float> A[10] : register(u0);
; RWBuffer<float> B[10] : register(u5);
; CHECK: error: resource A at register 0 overlaps with resource B at register 5 in space 0
@A.str = private unnamed_addr constant [2 x i8] c"A\00", align 1
@B.str = private unnamed_addr constant [2 x i8] c"B\00", align 1
define void @test_overlapping() {
entry:
%h1 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 10, i32 4, i1 false, ptr @A.str)
%h2 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 5, i32 10, i32 4, i1 false, ptr @B.str)
ret void
}