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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 03:03:55 PDT 2024


================
@@ -365,13 +365,33 @@ 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;
+      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:

But if you do RAUW, the weak handles handle the case where the value is ultimately deleted 

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


More information about the llvm-commits mailing list