[llvm] [AMDGPU] Do not use original PHIs in coercion chains (PR #98063)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 11:11:08 PDT 2024


================
@@ -365,13 +365,26 @@ bool LiveRegOptimizer::optimizeLiveType(
       else
         MissingIncVal = true;
     }
-    Instruction *DeadInst = Phi;
+
     if (MissingIncVal) {
-      DeadInst = cast<Instruction>(ValMap[Phi]);
-      // Do not use the dead phi
-      ValMap[Phi] = Phi;
-    }
-    DeadInsts.emplace_back(DeadInst);
+      Value *DeadVal = ValMap[Phi];
+      // The coercion chain of the PHI is broken. Delete the Phi
+      // from the ValMap and any connected / user Phis.
----------------
arsenm wrote:

Isn't that what the WeakTrackingVH is for? 

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


More information about the llvm-commits mailing list