[llvm] [DXIL][Analysis] Uniquify duplicate resources in DXILResourceAnalysis (PR #105602)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 10:28:16 PDT 2024


================
@@ -216,15 +240,88 @@ class ResourceInfo {
 
   MDTuple *getAsMetadata(LLVMContext &Ctx) const;
 
-  ResourceBinding getBinding() const { return Binding; }
   std::pair<uint32_t, uint32_t> getAnnotateProps() const;
 
   void print(raw_ostream &OS) const;
 };
 
 } // namespace dxil
 
-using DXILResourceMap = MapVector<CallInst *, dxil::ResourceInfo>;
+class DXILResourceMap {
+  SmallVector<dxil::ResourceInfo> Resources;
+  DenseMap<CallInst *, unsigned> CallMap;
----------------
bogner wrote:

These are the `dx.handle.fromBinding` calls as you can see in the test. We could/should arguably update them to point at the `dx.op.createHandle*` calls when we replace those, but that's not currently implemented.

See https://github.com/llvm/llvm-project/pull/104251/files#diff-abc4769e41f4d9022e3b88d8d752267e5d1bb26c0d4c4186f5d551c0dce76b80R177 for an example of the usage.

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


More information about the llvm-commits mailing list