diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/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(); } } diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/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. diff --git a/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp b/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp --- a/llvm/lib/Transforms/Utils/CallGraphUpdater.cpp +++ b/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: diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/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(); } } diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/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(); } }