[clang] [llvm] [HLSL] Add load overload with status (PR #166449)

Helena Kotas via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 11:13:14 PST 2025


================
@@ -104,6 +104,56 @@ export float TestLoad() {
 // CHECK-NEXT: %[[VAL:.*]] = load float, ptr %[[PTR]]
 // CHECK-NEXT: ret float %[[VAL]]
 
+export float TestLoadWithStatus() {
+    uint s1;
+    uint s2;
+    float ret = RWSB1.Load(1, s1) + SB1.Load(2, s2);
+    ret += float(s1 + s2);
+    return ret;
+}
+
+// CHECK: define noundef nofpclass(nan inf) float @TestLoadWithStatus()()
+// CHECK: call {{.*}} float @hlsl::RWStructuredBuffer<float>::Load(unsigned int, unsigned int&)(ptr {{.*}} @RWSB1, i32 noundef 1, ptr noalias noundef nonnull align 4 dereferenceable(4) %tmp)
----------------
hekota wrote:

You could do this in all of the tests to improve readibility:
```suggestion
// CHECK: call {{.*}} float @hlsl::RWStructuredBuffer<float>::Load(unsigned int, unsigned int&)(ptr {{.*}} @RWSB1, i32 noundef 1, ptr {{.*}} %tmp)
```

https://github.com/llvm/llvm-project/pull/166449


More information about the llvm-commits mailing list