Index: llvm/include/llvm/IR/IntrinsicInst.h =================================================================== --- llvm/include/llvm/IR/IntrinsicInst.h +++ llvm/include/llvm/IR/IntrinsicInst.h @@ -448,6 +448,7 @@ void setAssignId(DIAssignID *New); void setAddress(Value *V); void setValue(Value *V); + bool isAddressKillLocation(); /// \name Casting methods /// @{ static bool classof(const IntrinsicInst *I) { Index: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp =================================================================== --- llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -1235,10 +1235,8 @@ DILocation *DL = Source->getDebugLoc(); auto Emit = [this, Source, After, DL](Value *Val, DIExpression *Expr) { assert(Expr); - // It's possible that getVariableLocationOp(0) is null. Occurs in - // llvm/test/DebugInfo/Generic/2010-05-03-OriginDIE.ll Treat it as undef. if (!Val) - Val = UndefValue::get(Type::getInt1Ty(Source->getContext())); + Val = PoisonValue::get(Type::getInt1Ty(Source->getContext())); // Find a suitable insert point. Instruction *InsertBefore = After->getNextNode(); @@ -1284,16 +1282,13 @@ if (Kind == LocKind::Val) { /// Get the value component, converting to Undef if it is variadic. Value *Val = - Source->hasArgList() - ? UndefValue::get(Source->getVariableLocationOp(0)->getType()) - : Source->getVariableLocationOp(0); + Source->hasArgList() ? nullptr : Source->getVariableLocationOp(0); Emit(Val, Source->getExpression()); return; } if (Kind == LocKind::None) { - Value *Val = UndefValue::get(Source->getVariableLocationOp(0)->getType()); - Emit(Val, Source->getExpression()); + Emit(nullptr, Source->getExpression()); return; } } @@ -1479,7 +1474,7 @@ // that an assignment happened here, and we know that specific assignment // was the last one to take place in memory for this variable. LocKind Kind; - if (isa(DAI.getAddress())) { + if (DAI.isAddressKillLocation()) { // Address may be undef to indicate that although the store does take // place, this part of the original store has been elided. LLVM_DEBUG( @@ -2110,7 +2105,7 @@ // 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 PoisonValue::get(Type::getInt32Ty(DVI->getContext())); return DVI->getValue(); }; Instruction *InsertBefore = I.getNextNode(); Index: llvm/lib/IR/IntrinsicInst.cpp =================================================================== --- llvm/lib/IR/IntrinsicInst.cpp +++ llvm/lib/IR/IntrinsicInst.cpp @@ -217,6 +217,11 @@ MetadataAsValue::get(getContext(), ValueAsMetadata::get(V))); } +bool DbgAssignIntrinsic::isAddressKillLocation() { + Value *Addr = getAddress(); + return !Addr || isa(Addr); +} + int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef NameTable, StringRef Name) { assert(Name.startswith("llvm."));