[PATCH] D133640: Unreachable code RAUW from UndefValue to PoisonValue [NFC]

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 10 06:28:44 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb51c6130efac: Use PoisonValue instead of UndefValue when RAUWing unreachable code [NFC] (authored by ManuelJBrito, committed by nlopes).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133640/new/

https://reviews.llvm.org/D133640

Files:
  llvm/lib/CodeGen/WinEHPrepare.cpp
  llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
  llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
  llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
  llvm/tools/bugpoint/CrashDebugger.cpp


Index: llvm/tools/bugpoint/CrashDebugger.cpp
===================================================================
--- llvm/tools/bugpoint/CrashDebugger.cpp
+++ llvm/tools/bugpoint/CrashDebugger.cpp
@@ -791,7 +791,7 @@
             !Inst.isEHPad() && !Inst.getType()->isTokenTy() &&
             !Inst.isSwiftError()) {
           if (!Inst.getType()->isVoidTy())
-            Inst.replaceAllUsesWith(UndefValue::get(Inst.getType()));
+            Inst.replaceAllUsesWith(PoisonValue::get(Inst.getType()));
           Inst.eraseFromParent();
         }
       }
Index: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
===================================================================
--- llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -2666,7 +2666,7 @@
 #endif
     assert(!I->getType()->isVoidTy() &&
            "inserted instruction should have non-void types");
-    I->replaceAllUsesWith(UndefValue::get(I->getType()));
+    I->replaceAllUsesWith(PoisonValue::get(I->getType()));
     I->eraseFromParent();
   }
 }
Index: llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
===================================================================
--- llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
+++ llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
@@ -36,7 +36,7 @@
       CallGraphNode *DeadCGN = (*CG)[DeadFn];
       DeadCGN->removeAllCalledFunctions();
       CG->getExternalCallingNode()->removeAnyCallEdgeTo(DeadCGN);
-      DeadFn->replaceAllUsesWith(UndefValue::get(DeadFn->getType()));
+      DeadFn->replaceAllUsesWith(PoisonValue::get(DeadFn->getType()));
     }
 
     // Then remove the node and function from the module.
@@ -51,7 +51,7 @@
     // no call graph was provided.
     for (Function *DeadFn : DeadFunctions) {
       DeadFn->removeDeadConstantUsers();
-      DeadFn->replaceAllUsesWith(UndefValue::get(DeadFn->getType()));
+      DeadFn->replaceAllUsesWith(PoisonValue::get(DeadFn->getType()));
 
       if (LCG && !ReplacedFunctions.count(DeadFn)) {
         // Taken mostly from the inliner:
Index: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
===================================================================
--- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -149,7 +149,7 @@
     if (PN->getIncomingValue(0) != PN)
       PN->replaceAllUsesWith(PN->getIncomingValue(0));
     else
-      PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+      PN->replaceAllUsesWith(PoisonValue::get(PN->getType()));
 
     if (MemDep)
       MemDep->removeInstruction(PN);  // Memdep updates AA itself.
Index: llvm/lib/CodeGen/WinEHPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/WinEHPrepare.cpp
+++ llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -733,7 +733,7 @@
 
   for (auto *PN : PHINodes) {
     // There may be lingering uses on other EH PHIs being removed
-    PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+    PN->replaceAllUsesWith(PoisonValue::get(PN->getType()));
     PN->eraseFromParent();
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133640.459285.patch
Type: text/x-patch
Size: 3114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220910/65b5cdaa/attachment.bin>


More information about the llvm-commits mailing list