[llvm] [DirectX] Eliminate resource global variables from module (PR #114105)

Greg Roth via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 10:29:26 PST 2024


================
@@ -204,6 +204,22 @@ class OpLowerer {
     CleanupCasts.clear();
   }
 
+  // Remove the resource global associated with the handleFromBinding call instruction
+  // and their uses as they aren't needed anymore.
+  void removeResourceGlobals(CallInst *CI) {
+    for (User *User : make_early_inc_range(CI->users())) {
+      if(StoreInst *Store = dyn_cast<StoreInst>(User)) {
+	if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Store->getOperand(1))) {
----------------
pow2clk wrote:

That's the location of the global that gets stored to. In DXC, we would declare constants that made clear what these refer to, but I see no similar practice in LLVM.

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


More information about the llvm-commits mailing list