Index: llvm/include/llvm/IR/IntrinsicInst.h =================================================================== --- llvm/include/llvm/IR/IntrinsicInst.h +++ llvm/include/llvm/IR/IntrinsicInst.h @@ -267,7 +267,7 @@ getIntrinsicID() != Intrinsic::dbg_assign; } - void setUndef() { + void setKillLocation() { // TODO: When/if we remove duplicate values from DIArgLists, we don't need // this set anymore. SmallPtrSet RemovedValues; @@ -279,7 +279,7 @@ } } - bool isUndef() const { + bool isKillLocation() const { // Check for "kill" sentinel values. // Non-variadic: empty metadata. if (!hasArgList() && isa(getRawLocation())) Index: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp =================================================================== --- llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -2107,11 +2107,9 @@ continue; // Wrapper to get a single value (or undef) from DVI. auto GetValue = [DVI]() -> Value * { - // Conditions for undef: Any operand undef, zero operands or single - // operand is nullptr. We also can't handle variadic DIExpressions yet. - // Some of those conditions don't have a type we can pick for - // undef. Use i32. - if (DVI->isUndef() || DVI->getValue() == nullptr || DVI->hasArgList()) + // We can't handle variadic DIExpressions yet so treat those as + // kill locations. + if (DVI->isKillLocation() || DVI->hasArgList()) return UndefValue::get(Type::getInt32Ty(DVI->getContext())); return DVI->getValue(); }; Index: llvm/lib/CodeGen/CodeGenPrepare.cpp =================================================================== --- llvm/lib/CodeGen/CodeGenPrepare.cpp +++ llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -8328,7 +8328,7 @@ dbgs() << "Unable to find valid location for Debug Value, undefing:\n" << *DVI); - DVI->setUndef(); + DVI->setKillLocation(); break; } Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp =================================================================== --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -6389,7 +6389,7 @@ llvm::PHINode *LSRInductionVar, DVIRecoveryRec &DVIRec, const SCEV *SCEVInductionVar, SCEVDbgValueBuilder IterCountExpr) { - if (!DVIRec.DVI->isUndef()) + if (!DVIRec.DVI->isKillLocation()) return false; // LSR may have caused several changes to the dbg.value in the failed salvage @@ -6539,7 +6539,7 @@ continue; // Ensure that if any location op is undef that the dbg.vlue is not // cached. - if (DVI->isUndef()) + if (DVI->isKillLocation()) continue; // Check that the location op SCEVs are suitable for translation to @@ -6547,9 +6547,6 @@ const auto &HasTranslatableLocationOps = [&](const DbgValueInst *DVI) -> bool { for (const auto LocOp : DVI->location_ops()) { - if (!LocOp) - return false; - if (!SE.isSCEVable(LocOp->getType())) return false; Index: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp =================================================================== --- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -502,8 +502,8 @@ bool IsDbgValueKind = (!DAI || at::getAssignmentInsts(DAI).empty()); DebugVariable Aggregate = GetAggregateVariable(DVI); if (!SeenDefForAggregate.contains(Aggregate)) { - bool IsUndef = DVI->isUndef() && IsDbgValueKind; - if (!IsUndef) { + bool IsKill = DVI->isKillLocation() && IsDbgValueKind; + if (!IsKill) { SeenDefForAggregate.insert(Aggregate); } else if (DAI) { ToBeRemoved.push_back(DAI); Index: llvm/lib/Transforms/Utils/Debugify.cpp =================================================================== --- llvm/lib/Transforms/Utils/Debugify.cpp +++ llvm/lib/Transforms/Utils/Debugify.cpp @@ -345,7 +345,7 @@ if (I.getDebugLoc().getInlinedAt()) continue; // Skip undef values. - if (DVI->isUndef()) + if (DVI->isKillLocation()) continue; auto *Var = DVI->getVariable(); @@ -588,7 +588,7 @@ if (I.getDebugLoc().getInlinedAt()) continue; // Skip undef values. - if (DVI->isUndef()) + if (DVI->isKillLocation()) continue; auto *Var = DVI->getVariable(); Index: llvm/lib/Transforms/Utils/LoopUtils.cpp =================================================================== --- llvm/lib/Transforms/Utils/LoopUtils.cpp +++ llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -638,7 +638,7 @@ "There should be a non-PHI instruction in exit block, else these " "instructions will have no parent."); for (auto *DVI : DeadDebugInst) { - DVI->setUndef(); + DVI->setKillLocation(); DVI->moveBefore(InsertDbgValueBefore); } } Index: llvm/unittests/IR/DebugInfoTest.cpp =================================================================== --- llvm/unittests/IR/DebugInfoTest.cpp +++ llvm/unittests/IR/DebugInfoTest.cpp @@ -228,7 +228,7 @@ Instruction *DbgDeclare = &F.front().front(); ASSERT_TRUE(isa(DbgDeclare)); // Check that this form counts as a "no location" marker. - EXPECT_TRUE(DbgDeclare->isUndef()); + EXPECT_TRUE(DbgDeclare->isKillLocation()); } TEST(DIBuiler, CreateFile) {