diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -619,10 +619,8 @@ bool llvm::replaceDbgUsesWithUndef(Instruction *I) { SmallVector DbgUsers; findDbgUsers(DbgUsers, I); - for (auto *DII : DbgUsers) { - Value *Undef = UndefValue::get(I->getType()); - DII->replaceVariableLocationOp(I, Undef); - } + for (auto *DII : DbgUsers) + DII->setKillLocation(); return !DbgUsers.empty(); } @@ -1914,8 +1912,7 @@ // using DIArgList for dbg.assign yet. FIXME: support this. // Also do not salvage if the resulting DIArgList would contain an // unreasonably large number of values. - Value *Undef = UndefValue::get(I.getOperand(0)->getType()); - DII->replaceVariableLocationOp(I.getOperand(0), Undef); + DII->setKillLocation(); } LLVM_DEBUG(dbgs() << "SALVAGE: " << *DII << '\n'); Salvaged = true; @@ -1924,10 +1921,8 @@ if (Salvaged) return; - for (auto *DII : DbgUsers) { - Value *Undef = UndefValue::get(I.getType()); - DII->replaceVariableLocationOp(&I, Undef); - } + for (auto *DII : DbgUsers) + DII->setKillLocation(); } Value *getSalvageOpsForGEP(GetElementPtrInst *GEP, const DataLayout &DL,