[llvm] [HLSL] Add support to lookup a ResourceBindingInfo from its use (PR #126556)

Ashley Coleman via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 09:21:55 PST 2025


================
@@ -770,6 +770,45 @@ void DXILBindingMap::print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
   }
 }
 
+SmallVector<dxil::ResourceBindingInfo>
+DXILBindingMap::findByUse(const Value *Key) const {
+  if (const PHINode *Phi = dyn_cast<PHINode>(Key)) {
+    SmallVector<dxil::ResourceBindingInfo> Children;
+    for (const Value *V : Phi->operands()) {
+      Children.append(findByUse(V));
----------------
V-FEXrt wrote:

Uhhh maybe, but I dont think so? Can you formulate an example? I've been trying myself for a bit and everything I come up with violates SSA.

Visited lists are only relevant when cycles are possible and in order to introduce a cycle we need a CallInstr to reference something not yet defined and that's not allowed right? 

```
%bat = call @foo %bar
%bar = call @foo2  %bat
```

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


More information about the llvm-commits mailing list