[llvm] [DirectX] NonUniformResourceIndex lowering (PR #159608)

Helena Kotas via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 19 11:06:31 PDT 2025


================
@@ -250,13 +293,12 @@ class OpLowerer {
         IndexOp = IRB.CreateAdd(IndexOp,
                                 ConstantInt::get(Int32Ty, Binding.LowerBound));
 
-      // FIXME: The last argument is a NonUniform flag which needs to be set
-      // based on resource analysis.
-      // https://github.com/llvm/llvm-project/issues/155701
+      bool HasNonUniformIndex =
+          (Binding.Size == 1) ? false : hasNonUniformIndex(IndexOp);
----------------
hekota wrote:

When `Binding.Size == 1` it means this is a single resource and not an array, and in that case the index is should always be a constant `0`. This is tested in llvm/test/CodeGen/DirectX/CreateHandle.ll. 
I will add a test with binding size `1` and `NonUniformResourceIndex` in the index, which is something that should never get generated by Clang.

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


More information about the llvm-commits mailing list