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

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 15:39:05 PST 2025


================
@@ -770,6 +770,50 @@ void DXILBindingMap::print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
   }
 }
 
+SmallVector<dxil::ResourceBindingInfo>
+DXILBindingMap::findByUse(const Value *Key) const {
+  const PHINode *Phi = dyn_cast<PHINode>(Key);
+  if (Phi) {
----------------
bogner wrote:

Best to limit the scope by declaring `Phi` in the `if()` here
```suggestion
  if (const PHINode *Phi = dyn_cast<PHINode>(Key)) {
```

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


More information about the llvm-commits mailing list