[llvm] [SPIR-V] Prevent adding duplicate binding instructions for implicit binding (PR #161299)
Lucie Choi via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 30 13:44:18 PDT 2025
================
@@ -44,30 +44,34 @@ entry:
%3 = tail call target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefrombinding.tspirv.SignedImage_i32_5_2_0_0_2_0t(i32 0, i32 2, i32 1, i32 0, ptr nonnull @.str.6)
%4 = tail call target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefrombinding.tspirv.SignedImage_i32_5_2_0_0_2_0t(i32 10, i32 1, i32 1, i32 0, ptr nonnull @.str.8)
%5 = tail call target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefromimplicitbinding.tspirv.SignedImage_i32_5_2_0_0_2_0t(i32 2, i32 10, i32 1, i32 0, ptr nonnull @.str.10)
- %6 = tail call target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefromimplicitbinding.tspirv.SignedImage_i32_5_2_0_0_2_0t(i32 3, i32 10, i32 1, i32 0, ptr nonnull @.str.12)
+ %6 = tail call target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefromimplicitbinding.tspirv.SignedImage_i32_5_2_0_0_2_0t(i32 3, i32 10, i32 2, i32 0, ptr nonnull @.str.12)
%7 = tail call target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefrombinding.tspirv.SignedImage_i32_5_2_0_0_2_0t(i32 10, i32 2, i32 1, i32 0, ptr nonnull @.str.14)
----------------
luciechoi wrote:
1. The changes here were to increase the size of `@.str.10` and have variables access different index:
```
%6 = h[0]
...
%8 = h[1]
```
I believe we have to use the same `OrderId` to test the change. In our case, we are reusing the OrderId `3`.
I swapped the order of `%7` and `%8` for readability as well as add `CHECK-NOT`. Without the code change, this unit test is correctly failing.
2. I'm curious about the convention around adding/modifying the llvm ir tests here, I feel it might help if we can add the original hlsl scripts (e.g. as comments), but this could be due to my lack of familiarity!
https://github.com/llvm/llvm-project/pull/161299
More information about the llvm-commits
mailing list