[llvm] [HLSL] Raise Diag for Invalid CounterDirection (PR #137697)
Ashley Coleman via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 30 12:09:40 PDT 2025
================
@@ -0,0 +1,10 @@
+; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
+; CHECK: RWStructuredBuffers may increment or decrement their counters, but not both.
+
+define void @inc_and_dec() {
+entry:
+ %handle = call target("dx.RawBuffer", float, 1, 0) @llvm.dx.resource.handlefrombinding(i32 1, i32 2, i32 3, i32 4, i1 false)
+ call i32 @llvm.dx.resource.updatecounter(target("dx.RawBuffer", float, 1, 0) %handle, i8 -1)
+ call i32 @llvm.dx.resource.updatecounter(target("dx.RawBuffer", float, 1, 0) %handle, i8 1)
+ ret void
+}
----------------
V-FEXrt wrote:
`@llvm.dx.resource.updatecounter` requires a `%handle`, so while `@llvm.dx.resource.handlefrombinding` isn't specifically required, something that returns a `%handle` is
https://github.com/llvm/llvm-project/pull/137697
More information about the llvm-commits
mailing list