Index: llvm/bindings/go/llvm/dibuilder.go =================================================================== --- llvm/bindings/go/llvm/dibuilder.go +++ llvm/bindings/go/llvm/dibuilder.go @@ -655,6 +655,7 @@ DIMacroMetadataKind = C.LLVMDIMacroMetadataKind DIMacroFileMetadataKind = C.LLVMDIMacroFileMetadataKind DICommonBlockMetadataKind = C.LLVMDICommonBlockMetadataKind + EntryValueAsMetadataMetadataKind = C.LLVMEntryValueAsMetadataMetadataKind ) // Kind returns the metadata kind. Index: llvm/include/llvm-c/DebugInfo.h =================================================================== --- llvm/include/llvm-c/DebugInfo.h +++ llvm/include/llvm-c/DebugInfo.h @@ -160,7 +160,8 @@ LLVMDIMacroMetadataKind, LLVMDIMacroFileMetadataKind, LLVMDICommonBlockMetadataKind, - LLVMDIStringTypeMetadataKind + LLVMDIStringTypeMetadataKind, + LLVMEntryValueAsMetadataMetadataKind }; typedef unsigned LLVMMetadataKind; Index: llvm/include/llvm/IR/DIBuilder.h =================================================================== --- llvm/include/llvm/IR/DIBuilder.h +++ llvm/include/llvm/IR/DIBuilder.h @@ -90,7 +90,9 @@ Instruction * insertDbgValueIntrinsic(llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, - BasicBlock *InsertBB, Instruction *InsertBefore); + BasicBlock *InsertBB, Instruction *InsertBefore, + llvm::Value *EntryValue = nullptr, + llvm::DIExpression *EntryDIExpr = nullptr); public: /// Construct a builder for a module. @@ -864,11 +866,14 @@ /// \param Expr A complex location expression. /// \param DL Debug info location. /// \param InsertBefore Location for the new intrinsic. - Instruction *insertDbgValueIntrinsic(llvm::Value *Val, - DILocalVariable *VarInfo, - DIExpression *Expr, - const DILocation *DL, - Instruction *InsertBefore); + /// \param EntryValue An entry value. + /// \param EntryDIExpr An entry value expression. + Instruction * + insertDbgValueIntrinsic(llvm::Value *Val, DILocalVariable *VarInfo, + DIExpression *Expr, const DILocation *DL, + Instruction *InsertBefore, + llvm::Value *EntryValue = nullptr, + llvm::DIExpression *EntryDIExpr = nullptr); /// Replace the vtable holder in the given type. /// Index: llvm/include/llvm/IR/IntrinsicInst.h =================================================================== --- llvm/include/llvm/IR/IntrinsicInst.h +++ llvm/include/llvm/IR/IntrinsicInst.h @@ -211,6 +211,15 @@ return getVariableLocation(/* AllowNullOp = */ false); } + /// \return the entry value for the variable or nullptr. + Value *getVariableEntryValue() const; + + /// \return an expression that applies on the entry value. + DIExpression *getEntryExpression() const; + + /// Sets the entry value to undef. + void setEntryValueToUndef(); + /// \name Casting methods /// @{ static bool classof(const IntrinsicInst *I) { Index: llvm/include/llvm/IR/Intrinsics.td =================================================================== --- llvm/include/llvm/IR/Intrinsics.td +++ llvm/include/llvm/IR/Intrinsics.td @@ -894,6 +894,8 @@ llvm_metadata_ty]>; def int_dbg_value : Intrinsic<[], [llvm_metadata_ty, + llvm_metadata_ty, + llvm_metadata_ty, llvm_metadata_ty, llvm_metadata_ty]>; def int_dbg_addr : Intrinsic<[], Index: llvm/include/llvm/IR/Metadata.h =================================================================== --- llvm/include/llvm/IR/Metadata.h +++ llvm/include/llvm/IR/Metadata.h @@ -356,7 +356,7 @@ ~ValueAsMetadata() = default; public: - static ValueAsMetadata *get(Value *V); + static ValueAsMetadata *get(Value *V, bool IsEntryValue = false); static ConstantAsMetadata *getConstant(Value *C) { return cast(get(C)); @@ -366,6 +366,10 @@ return cast(get(Local)); } + static EntryValueAsMetadata *getEntryValue(Value *V) { + return cast(get(V)); + } + static ValueAsMetadata *getIfExists(Value *V); static ConstantAsMetadata *getConstantIfExists(Value *C) { @@ -376,6 +380,10 @@ return cast_or_null(getIfExists(Local)); } + static EntryValueAsMetadata *getEntryValueIfExists(Value *V) { + return cast_or_null(getIfExists(V)); + } + Value *getValue() const { return V; } Type *getType() const { return V->getType(); } LLVMContext &getContext() const { return V->getContext(); } @@ -396,7 +404,28 @@ public: static bool classof(const Metadata *MD) { return MD->getMetadataID() == LocalAsMetadataKind || - MD->getMetadataID() == ConstantAsMetadataKind; + MD->getMetadataID() == ConstantAsMetadataKind || + MD->getMetadataID() == EntryValueAsMetadataKind; + } +}; + +class EntryValueAsMetadata : public ValueAsMetadata { + friend class ValueAsMetadata; + + EntryValueAsMetadata(Value *V) + : ValueAsMetadata(EntryValueAsMetadataKind, V) {} + +public: + static EntryValueAsMetadata *get(Value *V) { + return ValueAsMetadata::getEntryValue(V); + } + + static EntryValueAsMetadata *getIfExists(Value *V) { + return ValueAsMetadata::getEntryValueIfExists(V); + } + + static bool classof(const Metadata *MD) { + return MD->getMetadataID() == EntryValueAsMetadataKind; } }; Index: llvm/include/llvm/IR/Metadata.def =================================================================== --- llvm/include/llvm/IR/Metadata.def +++ llvm/include/llvm/IR/Metadata.def @@ -76,6 +76,7 @@ HANDLE_METADATA_BRANCH(ValueAsMetadata) HANDLE_METADATA_LEAF(ConstantAsMetadata) HANDLE_METADATA_LEAF(LocalAsMetadata) +HANDLE_METADATA_LEAF(EntryValueAsMetadata) HANDLE_METADATA_LEAF(DistinctMDOperandPlaceholder) HANDLE_MDNODE_BRANCH(MDNode) HANDLE_MDNODE_LEAF_UNIQUABLE(MDTuple) Index: llvm/include/llvm/IR/Value.h =================================================================== --- llvm/include/llvm/IR/Value.h +++ llvm/include/llvm/IR/Value.h @@ -110,11 +110,19 @@ /// /// Note, this should *NOT* be used directly by any class other than User. /// User uses this value to find the Use list. - enum : unsigned { NumUserOperandsBits = 28 }; + enum : unsigned { NumUserOperandsBits = 27 }; unsigned NumUserOperands : NumUserOperandsBits; + /// A value could be used by regular metadata and/or as an entry value. + enum : unsigned { + NotUsedByMD = 0, + UsedBySSA = 1, + UsedByEV = 2, + UsedByEVandSSA = 3 + }; + unsigned IsUsedByMD : 2; + // Use the same type as the bitfield above so that MSVC will pack them. - unsigned IsUsedByMD : 1; unsigned HasName : 1; unsigned HasHungOffUses : 1; unsigned HasDescriptor : 1; @@ -548,7 +556,9 @@ bool hasValueHandle() const { return HasValueHandle; } /// Return true if there is metadata referencing this value. - bool isUsedByMetadata() const { return IsUsedByMD; } + bool isUsedByMetadata() const { + return IsUsedByMD != NotUsedByMD; + } /// Return true if this value is a swifterror value. /// Index: llvm/include/llvm/Transforms/Utils/Local.h =================================================================== --- llvm/include/llvm/Transforms/Utils/Local.h +++ llvm/include/llvm/Transforms/Utils/Local.h @@ -283,6 +283,17 @@ /// dbg.addr. TinyPtrVector FindDbgDeclareUses(Value *V); +/// Represents an entry value. +struct EntryValue { + // Value that is entry one. + Value *V; + // Expression that applies onto V. + DIExpression *Expr; +}; + +/// Finds an entry value for a variable. +Optional findEntryValue(Value *V, Function &F); + /// Finds the llvm.dbg.value intrinsics describing a value. void findDbgValues(SmallVectorImpl &DbgValues, Value *V); Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp =================================================================== --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -2398,6 +2398,8 @@ Record.clear(); continue; } + + assert(isa(V) && "Value expected to be a constant."); const Constant *C = cast(V); unsigned Code = -1U; unsigned AbbrevToUse = 0; Index: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp =================================================================== --- llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -678,9 +678,9 @@ if (!MD) return nullptr; - assert( - (isa(MD) || isa(MD) || isa(MD)) && - "Invalid metadata kind"); + assert((isa(MD) || isa(MD) || isa(MD) || + isa(MD)) && + "Invalid metadata kind"); auto Insertion = MetadataMap.insert(std::make_pair(MD, MDIndex(F))); MDIndex &Entry = Insertion.first->second; @@ -702,6 +702,12 @@ // Enumerate the constant, if any. if (auto *C = dyn_cast(MD)) EnumerateValue(C->getValue()); + else if (auto *EV = dyn_cast(MD)) { + if (isa(EV->getValue())) { + assert(isa(EV->getValue()) && "Must be undef as entry value"); + EnumerateValue(EV->getValue()); + } + } return nullptr; } Index: llvm/lib/IR/AutoUpgrade.cpp =================================================================== --- llvm/lib/IR/AutoUpgrade.cpp +++ llvm/lib/IR/AutoUpgrade.cpp @@ -708,7 +708,7 @@ break; } case 'd': { - if (Name == "dbg.value" && F->arg_size() == 4) { + if (Name == "dbg.value" && (F->arg_size() == 4 || F->arg_size() == 3)) { rename(F); NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::dbg_value); return true; @@ -3738,20 +3738,77 @@ NewCall = Builder.CreateCall(NewFn, {CI->getArgOperand(0)}); break; - case Intrinsic::dbg_value: + case Intrinsic::dbg_value: { // Upgrade from the old version that had an extra offset argument. - assert(CI->getNumArgOperands() == 4); + assert(CI->getNumArgOperands() == 4 || CI->getNumArgOperands() == 3); // Drop nonzero offsets instead of attempting to upgrade them. - if (auto *Offset = dyn_cast_or_null(CI->getArgOperand(1))) - if (Offset->isZeroValue()) { + if (CI->getNumArgOperands() == 4) { + if (auto *Offset = dyn_cast_or_null(CI->getArgOperand(1))) { + if (Offset->isZeroValue()) { + Type *EVType = nullptr; + if (isa(CI->getArgOperand(0))) { + auto MD = + cast(CI->getArgOperand(0))->getMetadata(); + if (isa(MD)) + EVType = cast(MD)->getType(); + } + + if (!EVType) + EVType = IntegerType::getInt64Ty(C); + + NewCall = Builder.CreateCall( + NewFn, + {CI->getArgOperand(0), CI->getArgOperand(2), CI->getArgOperand(3), + MetadataAsValue::get( + C, ValueAsMetadata::get(UndefValue::get(EVType), + /*IsEntryValue*/ true)), + MetadataAsValue::get(C, DIExpression::get(C, {}))}); + break; + } + } + } else if (CI->getNumArgOperands() == 3) { + Type *EVType = nullptr; + if (isa(CI->getArgOperand(0))) { + auto MD = cast(CI->getArgOperand(0))->getMetadata(); + if (isa(MD)) + EVType = cast(MD)->getType(); + } + + if (!EVType) + EVType = IntegerType::getInt64Ty(C); + + // This handles the old llvm.dbg.value: + // @llvm.dbg.value.old(metadata %0, i64 %1, metadata %2) + if (!CI->getArgOperand(1)->getType()->isMetadataTy()) { NewCall = Builder.CreateCall( NewFn, - {CI->getArgOperand(0), CI->getArgOperand(2), CI->getArgOperand(3)}); + {CI->getArgOperand(0), + MetadataAsValue::get( + C, ValueAsMetadata::get(CI->getArgOperand(1), false)), + CI->getArgOperand(2), + MetadataAsValue::get(C, + ValueAsMetadata::get(UndefValue::get(EVType), + /*IsEntryValue*/ true)), + MetadataAsValue::get(C, DIExpression::get(C, {}))}); break; } + + assert(CI->getArgOperand(0)->getType()->isMetadataTy() && + CI->getArgOperand(1)->getType()->isMetadataTy() && + CI->getArgOperand(2)->getType()->isMetadataTy() && + "All three dbg.value arguments should be metadata."); + + NewCall = Builder.CreateCall( + NewFn, + {CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), + MetadataAsValue::get(C, ValueAsMetadata::get(UndefValue::get(EVType), + /*IsEntryValue*/ true)), + MetadataAsValue::get(C, DIExpression::get(C, {}))}); + break; + } CI->eraseFromParent(); return; - + } case Intrinsic::x86_xop_vfrcz_ss: case Intrinsic::x86_xop_vfrcz_sd: NewCall = Builder.CreateCall(NewFn, {CI->getArgOperand(1)}); Index: llvm/lib/IR/Core.cpp =================================================================== --- llvm/lib/IR/Core.cpp +++ llvm/lib/IR/Core.cpp @@ -1090,6 +1090,8 @@ MD = MDV->getMetadata(); assert(!isa(MD) && "Unexpected function-local metadata " "outside of direct argument to call"); + if (isa(MD)) + return wrap(MetadataAsValue::get(Context, EntryValueAsMetadata::get(V))); } else { // This is function-local metadata. Pretend to make an MDNode. assert(Count == 1 && Index: llvm/lib/IR/DIBuilder.cpp =================================================================== --- llvm/lib/IR/DIBuilder.cpp +++ llvm/lib/IR/DIBuilder.cpp @@ -901,10 +901,12 @@ DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, - Instruction *InsertBefore) { + Instruction *InsertBefore, + Value *EntryValue, + DIExpression *EntryDIExpr) { return insertDbgValueIntrinsic( V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->getParent() : nullptr, - InsertBefore); + InsertBefore, EntryValue, EntryDIExpr); } Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, @@ -931,6 +933,12 @@ return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V)); } +static Value *getDbgIntrinsicEntryValueImpl(LLVMContext &VMContext, Value *V) { + assert(V && "no value passed to dbg intrinsic"); + return MetadataAsValue::get(VMContext, + ValueAsMetadata::get(V, /*IsEntryValue*/true)); +} + static Function *getDeclareIntrin(Module &M) { return Intrinsic::getDeclaration(&M, UseDbgAddr ? Intrinsic::dbg_addr : Intrinsic::dbg_declare); @@ -960,7 +968,8 @@ Instruction *DIBuilder::insertDbgValueIntrinsic( Value *V, DILocalVariable *VarInfo, DIExpression *Expr, - const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) { + const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore, + Value *EntryValue, DIExpression *EntryDIExpr) { assert(V && "no value passed to dbg.value"); assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value"); assert(DL && "Expected debug loc"); @@ -972,9 +981,17 @@ trackIfUnresolved(VarInfo); trackIfUnresolved(Expr); + + if (!EntryValue || DL->getInlinedAt()) + EntryValue = UndefValue::get(V->getType()); + if (!EntryDIExpr || DL->getInlinedAt()) + EntryDIExpr = DIExpression::get(VMContext, {}); + Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, V), MetadataAsValue::get(VMContext, VarInfo), - MetadataAsValue::get(VMContext, Expr)}; + MetadataAsValue::get(VMContext, Expr), + getDbgIntrinsicEntryValueImpl(VMContext, EntryValue), + MetadataAsValue::get(VMContext, EntryDIExpr)}; IRBuilder<> B(DL->getContext()); initIRBuilder(B, DL, InsertBB, InsertBefore); Index: llvm/lib/IR/DebugInfoMetadata.cpp =================================================================== --- llvm/lib/IR/DebugInfoMetadata.cpp +++ llvm/lib/IR/DebugInfoMetadata.cpp @@ -1029,8 +1029,7 @@ // entry values of a simple register location. One reason for this is that // we currently can't calculate the size of the resulting DWARF block for // other expressions. - return I->get() == expr_op_begin()->get() && I->getArg(0) == 1 && - getNumElements() == 2; + return I->get() == expr_op_begin()->get() && I->getArg(0) == 1; } case dwarf::DW_OP_LLVM_convert: case dwarf::DW_OP_LLVM_tag_offset: @@ -1195,8 +1194,9 @@ if (EntryValue) { Ops.push_back(dwarf::DW_OP_LLVM_entry_value); // Add size info needed for entry value expression. - // Add plus one for target register operand. - Ops.push_back(Expr->getNumElements() + 1); + // It is always of size 1 at the moment, since we support + // simple register locations only. + Ops.push_back(1); } // If there are no ops to prepend, do not even add the DW_OP_stack_value. Index: llvm/lib/IR/IntrinsicInst.cpp =================================================================== --- llvm/lib/IR/IntrinsicInst.cpp +++ llvm/lib/IR/IntrinsicInst.cpp @@ -58,6 +58,31 @@ return getVariable()->getSizeInBits(); } +Value *DbgValueInst::getVariableEntryValue() const { + Value *Op = getArgOperand(3); + if (!Op) + return nullptr; + + auto *MD = cast(Op)->getMetadata(); + if (auto *V = dyn_cast(MD)) + return V->getValue(); + + return nullptr; +} + +DIExpression *DbgValueInst::getEntryExpression() const { + return cast( + cast(getArgOperand(4))->getMetadata()); +} + +void DbgValueInst::setEntryValueToUndef() { + // FIXME: Do we need to use something like handleChangedMetadata()? + setOperand(3, MetadataAsValue::get( + getModule()->getContext(), + ValueAsMetadata::get(UndefValue::get(getValue()->getType()), + /*IsEntryValue*/ true))); +} + int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef NameTable, StringRef Name) { assert(Name.startswith("llvm.")); Index: llvm/lib/IR/LLVMContextImpl.h =================================================================== --- llvm/lib/IR/LLVMContextImpl.h +++ llvm/lib/IR/LLVMContextImpl.h @@ -1328,6 +1328,7 @@ StringMap MDStringCache; DenseMap ValuesAsMetadata; + DenseMap EntryValuesAsMetadata; DenseMap MetadataAsValues; DenseMap ValueNames; Index: llvm/lib/IR/LLVMContextImpl.cpp =================================================================== --- llvm/lib/IR/LLVMContextImpl.cpp +++ llvm/lib/IR/LLVMContextImpl.cpp @@ -69,6 +69,8 @@ // Also drop references that come from the Value bridges. for (auto &Pair : ValuesAsMetadata) Pair.second->dropUsers(); + for (auto &Pair : EntryValuesAsMetadata) + Pair.second->dropUsers(); for (auto &Pair : MetadataAsValues) Pair.second->dropUse(); @@ -126,6 +128,9 @@ // Destroy ValuesAsMetadata. for (auto &Pair : ValuesAsMetadata) delete Pair.second; + // Destroy EntryValuesAsMetadata. + for (auto &Pair : EntryValuesAsMetadata) + delete Pair.second; } void LLVMContextImpl::dropTriviallyDeadConstantArrays() { Index: llvm/lib/IR/Metadata.cpp =================================================================== --- llvm/lib/IR/Metadata.cpp +++ llvm/lib/IR/Metadata.cpp @@ -345,17 +345,30 @@ return nullptr; } -ValueAsMetadata *ValueAsMetadata::get(Value *V) { +ValueAsMetadata *ValueAsMetadata::get(Value *V, bool IsEntryValue) { assert(V && "Unexpected null Value"); auto &Context = V->getContext(); - auto *&Entry = Context.pImpl->ValuesAsMetadata[V]; + auto *&Entry = (IsEntryValue) ? Context.pImpl->EntryValuesAsMetadata[V] + : Context.pImpl->ValuesAsMetadata[V]; if (!Entry) { assert((isa(V) || isa(V) || isa(V)) && "Expected constant or function-local value"); - assert(!V->IsUsedByMD && "Expected this to be the only metadata use"); - V->IsUsedByMD = true; - if (auto *C = dyn_cast(V)) + + // Update Value's IsUsedByMD field. + if (IsEntryValue) { + assert((V->IsUsedByMD & Value::UsedByEV) == 0 && + "Expected this to be a metadata use in Entry Value only"); + V->IsUsedByMD |= Value::UsedByEV; + } else { + assert((V->IsUsedByMD & Value::UsedBySSA) == 0 && + "Expected this to be a metadata use in SSA value only"); + V->IsUsedByMD |= Value::UsedBySSA; + } + + if (IsEntryValue) + Entry = new EntryValueAsMetadata(V); + else if (auto *C = dyn_cast(V)) Entry = new ConstantAsMetadata(C); else Entry = new LocalAsMetadata(V); @@ -372,6 +385,20 @@ void ValueAsMetadata::handleDeletion(Value *V) { assert(V && "Expected valid value"); + auto &EntryValues = V->getType()->getContext().pImpl->EntryValuesAsMetadata; + auto EV = EntryValues.find(V); + if (EV != EntryValues.end()) { + // Remove old entry from the map. + ValueAsMetadata *MD = EV->second; + assert(MD && "Expected valid metadata"); + assert(MD->getValue() == V && "Expected valid mapping"); + EntryValues.erase(EV); + + // Delete the metadata. + MD->replaceAllUsesWith(nullptr); + delete MD; + } + auto &Store = V->getType()->getContext().pImpl->ValuesAsMetadata; auto I = Store.find(V); if (I == Store.end()) @@ -394,17 +421,54 @@ assert(From != To && "Expected changed value"); assert(From->getType() == To->getType() && "Unexpected type change"); + // If there was an Entry Value represented by From, update the + // Entry Value to undef. LLVMContext &Context = From->getType()->getContext(); + auto &EntryValues = Context.pImpl->EntryValuesAsMetadata; + auto EV = EntryValues.find(From); + bool IsEntryValue = (EV != EntryValues.end()); + if (IsEntryValue) { + ValueAsMetadata *EntryValueMD = EV->second; + assert(EntryValueMD && "Expected valid metadata from EntryValue"); + assert(EntryValueMD->getValue() == From && + "Expected valid mapping from EntryValue"); + assert(isa(EntryValueMD) && + "Expected EntryValueAsMetadata type from EntryValue"); + EntryValues.erase(EV); + + Value *Undef = UndefValue::get(To->getType()); + auto *&UndefEntry = EntryValues[Undef]; + if (!UndefEntry) { + EntryValues.insert(std::make_pair( + Undef, ValueAsMetadata::get(UndefValue::get(From->getType()), + /*IsEntryValue*/ true))); + UndefEntry = EntryValues[Undef]; + } + + // Update Value's IsUsedByMD field. + assert((From->IsUsedByMD & Value::UsedByEV) && + "Expected this to be used by metadata in Entry Value"); + From->IsUsedByMD &= ~Value::UsedByEV; + + EntryValueMD->replaceAllUsesWith(UndefEntry); + delete EntryValueMD; + } + + // Handle regular SSA Value as metadata. auto &Store = Context.pImpl->ValuesAsMetadata; auto I = Store.find(From); + if (I == Store.end()) { - assert(!From->IsUsedByMD && "Expected From not to be used by metadata"); + assert((From->IsUsedByMD & Value::UsedBySSA) == 0 && + "Expected From not to be used by metadata in SSA value"); return; } - // Remove old entry from the map. - assert(From->IsUsedByMD && "Expected From to be used by metadata"); - From->IsUsedByMD = false; + // Update Value's IsUsedByMD field. + assert((From->IsUsedByMD & Value::UsedBySSA) && + "Expected From to be used by metadata in SSA value"); + From->IsUsedByMD &= ~Value::UsedBySSA; + ValueAsMetadata *MD = I->second; assert(MD && "Expected valid metadata"); assert(MD->getValue() == From && "Expected valid mapping"); @@ -440,8 +504,10 @@ } // Update MD in place (and update the map entry). - assert(!To->IsUsedByMD && "Expected this to be the only metadata use"); - To->IsUsedByMD = true; + // Update Value's IsUsedByMD field. + assert((To->IsUsedByMD & Value::UsedBySSA) == 0 && + "Expected this to be the only metadata use in SSA value"); + To->IsUsedByMD |= Value::UsedBySSA; MD->V = To; Entry = MD; } Index: llvm/lib/IR/Value.cpp =================================================================== --- llvm/lib/IR/Value.cpp +++ llvm/lib/IR/Value.cpp @@ -53,7 +53,7 @@ Value::Value(Type *ty, unsigned scid) : VTy(checkType(ty)), UseList(nullptr), SubclassID(scid), HasValueHandle(0), SubclassOptionalData(0), SubclassData(0), - NumUserOperands(0), IsUsedByMD(false), HasName(false) { + NumUserOperands(0), IsUsedByMD(NotUsedByMD), HasName(false) { static_assert(ConstantFirstVal == 0, "!(SubclassID < ConstantFirstVal)"); // FIXME: Why isn't this in the subclass gunk?? // Note, we cannot call isa before the CallInst has been Index: llvm/lib/IR/Verifier.cpp =================================================================== --- llvm/lib/IR/Verifier.cpp +++ llvm/lib/IR/Verifier.cpp @@ -5373,6 +5373,17 @@ DebugFnArgs[ArgNo - 1] = Var; AssertDI(!Prev || (Prev == Var), "conflicting debug info for argument", &I, Prev, Var); + + if (!isa(&I)) + return; + + // Validate the entry value argument. + const DbgValueInst &DVI = cast(I); + + Value* EntryValue = DVI.getVariableEntryValue(); + AssertDI(EntryValue, "dbg_value with null entry-value (should be undef)"); + AssertDI(isa(EntryValue) || isa(EntryValue), + "dbg_value with non-argument entry-value"); } void Verifier::verifyNotEntryValue(const DbgVariableIntrinsic &I) { Index: llvm/lib/Transforms/Utils/InlineFunction.cpp =================================================================== --- llvm/lib/Transforms/Utils/InlineFunction.cpp +++ llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1529,6 +1529,27 @@ } } +/// We can't rely on the entry values for inlined functions, so we set it +/// to undef. +static void invalidateEntryValues(Function *Fn, Function::iterator FI, + Instruction *TheCall) { + for (; FI != Fn->end(); ++FI) + for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); + BI != BE; ++BI) { + DbgValueInst *DVI = dyn_cast(&(*BI)); + if (!DVI) + continue; + + auto UndefVal = + dyn_cast_or_null(DVI->getVariableEntryValue()); + + if (UndefVal) + continue; + + DVI->setEntryValueToUndef(); + } +} + /// Update the block frequencies of the caller after a callee has been inlined. /// /// Each block cloned into the caller has its block frequency scaled by the @@ -1885,6 +1906,9 @@ fixupLineNumbers(Caller, FirstNewBlock, &CB, CalledFunc->getSubprogram() != nullptr); + if (CalledFunc->getSubprogram() != nullptr) + invalidateEntryValues(Caller, FirstNewBlock, &CB); + // Clone existing noalias metadata if necessary. CloneAliasScopeMetadata(CB, VMap); Index: llvm/lib/Transforms/Utils/Local.cpp =================================================================== --- llvm/lib/Transforms/Utils/Local.cpp +++ llvm/lib/Transforms/Utils/Local.cpp @@ -1369,7 +1369,17 @@ return; } - Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, NewLoc, SI); + // If this value can be expressed in terms of an entry value, remember it and + // keep using it as a backup value for the variable. + auto EntryValue = findEntryValue(DV, *(DII->getParent()->getParent())); + Value *EV = nullptr; + DIExpression *EVExpr = nullptr; + if (EntryValue) { + EV = EntryValue->V; + EVExpr = EntryValue->Expr; + } + + Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, NewLoc, SI, EV, EVExpr); } /// Inserts a llvm.dbg.value intrinsic before a load of an alloca'd value @@ -1593,6 +1603,46 @@ return DDIs; } +Optional llvm::findEntryValue(Value *V, Function &F) { + if (F.empty()) + return None; + + // TODO: Support types other than integer. + if (!V->getType()->isIntegerTy() || V->getType()->isPointerTy()) + return None; + if (isa(V) || isa(V)) + return None; + + DIExpression *DIExpr = DIExpression::get(F.getContext(), {}); + // If the value is an entry itself. + if (isa(V)) + return EntryValue{V, DIExpr}; + + if (!isa(V)) + return None; + + Instruction *I = cast(V); + + // Support binary operators only for now. + if (!isa(V)) + return None; + + // TODO: Cover cases where an entry value is implicitly used. We need to call + // the salvageDebugInfoImpl() multiple times, until we find the entry value. + + auto Op0 = I->getOperand(0); + // Not an entry value. + if (!isa(Op0)) + return None; + + // Try to express the entry value in terms of DWARF. + DIExpr = salvageDebugInfoImpl(*I, DIExpr, true); + if (!DIExpr) + return None; + + return EntryValue{Op0, DIExpr}; +} + void llvm::findDbgValues(SmallVectorImpl &DbgValues, Value *V) { // This function is hot. Check whether the value has any metadata to avoid a // DenseMap lookup. Index: llvm/lib/Transforms/Utils/ValueMapper.cpp =================================================================== --- llvm/lib/Transforms/Utils/ValueMapper.cpp +++ llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -394,6 +394,19 @@ MDTuple::get(V->getContext(), None)); } + if (auto *EVM = dyn_cast(MD)) { + if (Value *EV = mapValue(EVM->getValue())) { + if (V == EVM->getValue()) + return const_cast(V); + return MetadataAsValue::get(V->getContext(), + ValueAsMetadata::get(EV, true)); + } else { + return MetadataAsValue::get(V->getContext(), + ValueAsMetadata::get(UndefValue::get(V->getType()), + /*IsEntryValue*/ true)); + } + } + // If this is a module-level metadata and we know that nothing at the module // level is changing, then use an identity mapping. if (Flags & RF_NoModuleLevelChanges) @@ -803,6 +816,7 @@ Metadata *Mapper::mapMetadata(const Metadata *MD) { assert(MD && "Expected valid metadata"); assert(!isa(MD) && "Unexpected local metadata"); + assert(!isa(MD) && "Unexpected entry-value metadata"); if (Optional NewMD = mapSimpleMetadata(MD)) return *NewMD; Index: llvm/test/Bindings/llvm-c/debug_info.ll =================================================================== --- llvm/test/Bindings/llvm-c/debug_info.ll +++ llvm/test/Bindings/llvm-c/debug_info.ll @@ -9,14 +9,14 @@ ; CHECK-NEXT: call void @llvm.dbg.declare(metadata i64 0, metadata !39, metadata !DIExpression()), !dbg !43 ; CHECK-NEXT: call void @llvm.dbg.declare(metadata i64 0, metadata !40, metadata !DIExpression()), !dbg !43 ; CHECK: vars: ; No predecessors! -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 0, metadata !41, metadata !DIExpression(DW_OP_constu, 0, DW_OP_stack_value)), !dbg !44 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 0, metadata !41, metadata !DIExpression(DW_OP_constu, 0, DW_OP_stack_value), metadata i64 undef, metadata !DIExpression()), !dbg !44 ; CHECK-NEXT: } ; CHECK: ; Function Attrs: nounwind readnone speculatable ; CHECK-NEXT: declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 ; CHECK: ; Function Attrs: nounwind readnone speculatable -; CHECK-NEXT: declare void @llvm.dbg.value(metadata, metadata, metadata) #0 +; CHECK-NEXT: declare void @llvm.dbg.value(metadata, metadata, metadata, metadata, metadata) #0 ; CHECK: attributes #0 = { nounwind readnone speculatable willreturn } Index: llvm/test/Bitcode/upgrade-dbg-value.ll =================================================================== --- llvm/test/Bitcode/upgrade-dbg-value.ll +++ llvm/test/Bitcode/upgrade-dbg-value.ll @@ -6,14 +6,14 @@ define void @f() !dbg !3 { entry: ; CHECK-NOT: call void @llvm.dbg.value - ; CHECK: call void @llvm.dbg.value(metadata i32 42, metadata !8, metadata !DIExpression()) + ; CHECK: call void @llvm.dbg.value(metadata i32 42, metadata !8, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) call void @llvm.dbg.value(metadata i32 42, i64 0, metadata !8, metadata !9), !dbg !10 ; CHECK-NOT: call void @llvm.dbg.value call void @llvm.dbg.value(metadata i32 0, i64 1, metadata !8, metadata !9), !dbg !10 ret void } -; CHECK: declare void @llvm.dbg.value(metadata, metadata, metadata) +; CHECK: declare void @llvm.dbg.value(metadata, metadata, metadata, metadata, metadata) declare void @llvm.dbg.value(metadata, i64, metadata, metadata) !llvm.dbg.cu = !{!0} Index: llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir =================================================================== --- llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir +++ llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir @@ -9,10 +9,10 @@ define i32 @test(i32 %a, i32 %b) { %add = add i32 %a, 2 ; ALL-NEXT: %add = add i32 %a, 2, !dbg [[L1:![0-9]+]] - ; VALUE-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata [[add:![0-9]+]], metadata !DIExpression()), !dbg [[L1]] + ; VALUE-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata [[add:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg [[L1]] %sub = sub i32 %add, %b ; ALL-NEXT: %sub = sub i32 %add, %b, !dbg [[L2:![0-9]+]] - ; VALUE-NEXT: call void @llvm.dbg.value(metadata i32 %sub, metadata [[sub:![0-9]+]], metadata !DIExpression()), !dbg [[L2]] + ; VALUE-NEXT: call void @llvm.dbg.value(metadata i32 %sub, metadata [[sub:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg [[L2]] ; ALL-NEXT: ret i32 %sub, !dbg [[L3:![0-9]+]] ret i32 %sub } Index: llvm/test/CodeGen/Generic/MIRStripDebug/dont-strip-real-debug-info.mir =================================================================== --- llvm/test/CodeGen/Generic/MIRStripDebug/dont-strip-real-debug-info.mir +++ llvm/test/CodeGen/Generic/MIRStripDebug/dont-strip-real-debug-info.mir @@ -13,9 +13,9 @@ } ; CHECK-LABEL: define i32 @test(i32 %a, i32 %b) !dbg !4 { ; CHECK-NEXT: %add = add i32 %a, 2, !dbg !10 - ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata !7, metadata !DIExpression()), !dbg !10 + ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata !7, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !10 ; CHECK-NEXT: %sub = sub i32 %add, %b, !dbg !11 - ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %sub, metadata !9, metadata !DIExpression()), !dbg !11 + ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %sub, metadata !9, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !11 ; CHECK-NEXT: ret i32 %sub, !dbg !12 ; CHECK-NEXT: } Index: llvm/test/CodeGen/X86/pr38763.ll =================================================================== --- llvm/test/CodeGen/X86/pr38763.ll +++ llvm/test/CodeGen/X86/pr38763.ll @@ -36,7 +36,7 @@ ; CHECK: %sub = add nsw i32 %foo.0.4, -2, !dbg !16 ; CHECK-NOT: @llvm.dbg.value(metadata i32 %sub ; CHECK: %result.0 = select i1 %cmp, i32 %add, i32 %sub -; CHECK: call void @llvm.dbg.value(metadata i32 %result.0, metadata !12, metadata !DIExpression()), !dbg !13 +; CHECK: call void @llvm.dbg.value(metadata i32 %result.0, metadata !12, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !13 ; ModuleID = 'pr38763.cpp' source_filename = "pr38763.cpp" Index: llvm/test/DebugInfo/ARM/salvage-debug-info.ll =================================================================== --- llvm/test/DebugInfo/ARM/salvage-debug-info.ll +++ llvm/test/DebugInfo/ARM/salvage-debug-info.ll @@ -31,7 +31,7 @@ if.then: ; preds = %entry %1 = inttoptr i32 %0 to %struct.info*, !dbg !27 tail call void @llvm.dbg.value(metadata %struct.info* %1, metadata !22, metadata !DIExpression()), !dbg !28 - ; CHECK: call void @llvm.dbg.value(metadata i32 %0, metadata !22, metadata !DIExpression()) + ; CHECK: call void @llvm.dbg.value(metadata i32 %0, metadata !22, metadata !DIExpression(), metadata %struct.info* undef, metadata !DIExpression()) tail call void @llvm.dbg.value(metadata i32 0, metadata !20, metadata !DIExpression()), !dbg !29 %2 = load i32, i32* @n, align 4, !dbg !30 %cmp5 = icmp eq i32 %2, 0, !dbg !33 Index: llvm/test/DebugInfo/ARM/sroa-complex.ll =================================================================== --- llvm/test/DebugInfo/ARM/sroa-complex.ll +++ llvm/test/DebugInfo/ARM/sroa-complex.ll @@ -20,11 +20,11 @@ ; Test that debug info for both values survives: ; CHECK: call void @llvm.dbg.value(metadata i64 0, ; CHECK-SAME: metadata ![[C:[^,]*]], - ; CHECK-SAME: metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)) + ; CHECK-SAME: metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64) store double 0.000000e+00, double* %c.imagp, align 8, !dbg !17 ; CHECK: call void @llvm.dbg.value(metadata i64 0, ; CHECK-SAME: metadata ![[C]], - ; CHECK-SAME: metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)) + ; CHECK-SAME: metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64) ret void, !dbg !18 } Index: llvm/test/DebugInfo/Generic/dbg-value-lower-linenos.ll =================================================================== --- llvm/test/DebugInfo/Generic/dbg-value-lower-linenos.ll +++ llvm/test/DebugInfo/Generic/dbg-value-lower-linenos.ll @@ -55,7 +55,7 @@ ; CHECK-SAME: !dbg ![[UNKNOWN2:[0-9]+]] ; CHECK-NEXT: store ; CHECK-NEXT: dbg.value(metadata i32* %map.addr, metadata ![[MAPVAR]], -; CHECK-SAME: metadata !DIExpression(DW_OP_deref)), +; CHECK-SAME: metadata !DIExpression(DW_OP_deref), {{.*}}), ; CHECK-SAME: !dbg ![[UNKNOWN2]] ; CHECK-NEXT: call ; CHECK-NEXT: load Index: llvm/test/DebugInfo/Generic/sroa-larger.ll =================================================================== --- llvm/test/DebugInfo/Generic/sroa-larger.ll +++ llvm/test/DebugInfo/Generic/sroa-larger.ll @@ -41,7 +41,7 @@ call void @llvm.lifetime.start.p0i8(i64 16, i8* %0) call void @llvm.dbg.declare(metadata %struct.F* %tmp, metadata !10, metadata !DIExpression()), !dbg !14 ; CHECK-NOT: !DIExpression(DW_OP_LLVM_fragment, 32, 96) - ; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata !10, metadata !DIExpression()) + ; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata !10, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) %_Myval2.i.i.i.i.i = bitcast %struct.F* %tmp to i32* store i32 0, i32* %_Myval2.i.i.i.i.i, align 8 ret void Index: llvm/test/DebugInfo/Generic/sroa-samesize.ll =================================================================== --- llvm/test/DebugInfo/Generic/sroa-samesize.ll +++ llvm/test/DebugInfo/Generic/sroa-samesize.ll @@ -35,7 +35,7 @@ %call.i.i = call i32 @"\01?x4@@YAHXZ"(), !dbg !46, !noalias !47 %x3.i.i.i = bitcast %struct.B* %agg.tmp.ensured to i32*, !dbg !50 store i32 0, i32* %x3.i.i.i, align 4, !dbg !50, !tbaa !57, !alias.scope !47 - ; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[A:.*]], metadata !DIExpression()) + ; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[A:.*]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) ; CHECK: ![[A]] = !DILocalVariable(name: "a", ret void, !dbg !62 } Index: llvm/test/DebugInfo/X86/array2.ll =================================================================== --- llvm/test/DebugInfo/X86/array2.ll +++ llvm/test/DebugInfo/X86/array2.ll @@ -16,7 +16,7 @@ ; Test that we correctly lower dbg.declares for arrays. ; ; CHECK: define i32 @main -; CHECK: call void @llvm.dbg.value(metadata i32 42, metadata ![[ARRAY:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)) +; CHECK: call void @llvm.dbg.value(metadata i32 42, metadata ![[ARRAY:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32), metadata i32 undef, metadata !DIExpression()) ; CHECK: ![[ARRAY]] = !DILocalVariable(name: "array",{{.*}} line: 6 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9.0" Index: llvm/test/DebugInfo/X86/dbg-value-dropped-instcombine.ll =================================================================== --- llvm/test/DebugInfo/X86/dbg-value-dropped-instcombine.ll +++ llvm/test/DebugInfo/X86/dbg-value-dropped-instcombine.ll @@ -21,8 +21,8 @@ ; } ; CHECK: define dso_local i64 @foo -; CHECK: @llvm.dbg.value(metadata i64 {{.*}}, metadata ![[BEE:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), -; CHECK: @llvm.dbg.value(metadata i64 {{.*}}, metadata ![[BEE]], metadata !DIExpression({{.*}}, DW_OP_LLVM_fragment, 32, 32)), +; CHECK: @llvm.dbg.value(metadata i64 {{.*}}, metadata ![[BEE:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32) +; CHECK: @llvm.dbg.value(metadata i64 {{.*}}, metadata ![[BEE]], metadata !DIExpression({{.*}}, DW_OP_LLVM_fragment, 32, 32) target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-unknown" Index: llvm/test/DebugInfo/X86/entry-values-after-sroa.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/X86/entry-values-after-sroa.ll @@ -0,0 +1,73 @@ +; RUN: opt %s -sroa -instcombine -inline -instcombine -sroa -verify -S -o - | FileCheck %s + +;; C reproducer: +;; void foo(int param) { +;; int i = param + 3; +;; int j = i + 6; +;; } +;; (clang -g -O2 -S -emit-llvm test.c -mllvm -disable-llvm-optzns) + +;; TODO: Express the value of "j" in terms of entry value. + +; CHECK: call void @llvm.dbg.value(metadata i32 %param, metadata !12, metadata !DIExpression(), metadata i32 %param, metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 %param, metadata !13, metadata !DIExpression(DW_OP_plus_uconst, 3, DW_OP_stack_value), metadata i32 %param, metadata !DIExpression(DW_OP_plus_uconst, 3, DW_OP_stack_value)) +; CHECK: call void @llvm.dbg.value(metadata i32 %param, metadata !14, metadata !DIExpression(DW_OP_plus_uconst, 3, DW_OP_plus_uconst, 6, DW_OP_stack_value), metadata i32 undef, metadata !DIExpression()) + +; ModuleID = 'test.c' +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" +; Function Attrs: nounwind uwtable +define dso_local void @foo(i32 %param) !dbg !7 { +entry: + %param.addr = alloca i32, align 4 + %i = alloca i32, align 4 + %j = alloca i32, align 4 + store i32 %param, i32* %param.addr, align 4 + call void @llvm.dbg.declare(metadata i32* %param.addr, metadata !12, metadata !DIExpression()), !dbg !19 + %0 = bitcast i32* %i to i8*, !dbg !20 + call void @llvm.dbg.declare(metadata i32* %i, metadata !13, metadata !DIExpression()), !dbg !21 + %1 = load i32, i32* %param.addr, align 4, !dbg !22 + %add = add nsw i32 %1, 3, !dbg !23 + store i32 %add, i32* %i, align 4, !dbg !21 + %2 = bitcast i32* %j to i8*, !dbg !24 + call void @llvm.dbg.declare(metadata i32* %j, metadata !14, metadata !DIExpression()), !dbg !25 + %3 = load i32, i32* %i, align 4, !dbg !26 + %add1 = add nsw i32 %3, 6, !dbg !27 + store i32 %add1, i32* %j, align 4, !dbg !25 + %4 = bitcast i32* %j to i8*, !dbg !28 + %5 = bitcast i32* %i to i8*, !dbg !28 + ret void, !dbg !28 +} + +; Function Attrs: nounwind readnone speculatable willreturn +declare void @llvm.dbg.declare(metadata, metadata, metadata) + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "test.c", directory: "/") +!2 = !{} +!3 = !{i32 7, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{!"clang version 12.0.0"} +!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11) +!8 = !DISubroutineType(types: !9) +!9 = !{null, !10} +!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!11 = !{!12, !13, !14} +!12 = !DILocalVariable(name: "param", arg: 1, scope: !7, file: !1, line: 1, type: !10) +!13 = !DILocalVariable(name: "i", scope: !7, file: !1, line: 2, type: !10) +!14 = !DILocalVariable(name: "j", scope: !7, file: !1, line: 3, type: !10) +!19 = !DILocation(line: 1, column: 14, scope: !7) +!20 = !DILocation(line: 2, column: 3, scope: !7) +!21 = !DILocation(line: 2, column: 7, scope: !7) +!22 = !DILocation(line: 2, column: 11, scope: !7) +!23 = !DILocation(line: 2, column: 17, scope: !7) +!24 = !DILocation(line: 3, column: 3, scope: !7) +!25 = !DILocation(line: 3, column: 7, scope: !7) +!26 = !DILocation(line: 3, column: 11, scope: !7) +!27 = !DILocation(line: 3, column: 13, scope: !7) +!28 = !DILocation(line: 4, column: 1, scope: !7) Index: llvm/test/DebugInfo/X86/instcombine-demanded-bits-salvage.ll =================================================================== --- llvm/test/DebugInfo/X86/instcombine-demanded-bits-salvage.ll +++ llvm/test/DebugInfo/X86/instcombine-demanded-bits-salvage.ll @@ -9,7 +9,7 @@ entry: %conv = load i32, i32* @a, align 4, !dbg !14 %0 = and i32 %conv, 65535, !dbg !14 - ; CHECK: metadata !DIExpression(DW_OP_constu, 65535, DW_OP_and, DW_OP_stack_value)) + ; CHECK: metadata !DIExpression(DW_OP_constu, 65535, DW_OP_and, DW_OP_stack_value) call void @llvm.dbg.value(metadata i32 %0, metadata !15, metadata !DIExpression()), !dbg !14 %1 = lshr i32 %0, 12, !dbg !14 %2 = and i32 %1, 8, !dbg !14 Index: llvm/test/DebugInfo/X86/sroasplit-1.ll =================================================================== --- llvm/test/DebugInfo/X86/sroasplit-1.ll +++ llvm/test/DebugInfo/X86/sroasplit-1.ll @@ -22,7 +22,7 @@ ; Verify that SROA creates a variable piece when splitting i1. ; CHECK: %[[I1:.*]] = alloca [12 x i8], align 4 ; CHECK: call void @llvm.dbg.declare(metadata [12 x i8]* %[[I1]], metadata ![[VAR:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 32, 96)) -; CHECK: call void @llvm.dbg.value(metadata i32 %[[A:.*]], metadata ![[VAR]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)) +; CHECK: call void @llvm.dbg.value(metadata i32 %[[A:.*]], metadata ![[VAR]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32) ; CHECK: ret i32 %[[A]] ; Read Var and Piece: ; CHECK: ![[VAR]] = !DILocalVariable(name: "i1",{{.*}} line: 11, Index: llvm/test/DebugInfo/X86/sroasplit-2.ll =================================================================== --- llvm/test/DebugInfo/X86/sroasplit-2.ll +++ llvm/test/DebugInfo/X86/sroasplit-2.ll @@ -20,10 +20,10 @@ ; ; Verify that SROA creates a variable piece when splitting i1. -; CHECK: call void @llvm.dbg.value(metadata i64 %outer.coerce0, metadata ![[O:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), -; CHECK: call void @llvm.dbg.value(metadata i32 {{.*}}, metadata ![[O]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32)), -; CHECK: call void @llvm.dbg.value(metadata i32 {{.*}}, metadata ![[O]], metadata !DIExpression(DW_OP_LLVM_fragment, 96, 32)), -; CHECK: call void @llvm.dbg.value({{.*}}, metadata ![[I1:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), +; CHECK: call void @llvm.dbg.value(metadata i64 %outer.coerce0, metadata ![[O:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64) +; CHECK: call void @llvm.dbg.value(metadata i32 {{.*}}, metadata ![[O]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32) +; CHECK: call void @llvm.dbg.value(metadata i32 {{.*}}, metadata ![[O]], metadata !DIExpression(DW_OP_LLVM_fragment, 96, 32) +; CHECK: call void @llvm.dbg.value({{.*}}, metadata ![[I1:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32) ; CHECK-DAG: ![[O]] = !DILocalVariable(name: "outer",{{.*}} line: 10 ; CHECK-DAG: ![[I1]] = !DILocalVariable(name: "i1",{{.*}} line: 11 Index: llvm/test/DebugInfo/X86/sroasplit-3.ll =================================================================== --- llvm/test/DebugInfo/X86/sroasplit-3.ll +++ llvm/test/DebugInfo/X86/sroasplit-3.ll @@ -3,7 +3,7 @@ ; Test that SROA updates the debug info correctly if an alloca was rewritten but ; not partitioned into multiple allocas. ; -; CHECK: call void @llvm.dbg.value(metadata float %s.coerce, metadata ![[VAR:[0-9]+]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata float %s.coerce, metadata ![[VAR:[0-9]+]], metadata !DIExpression() ; CHECK: ![[VAR]] = !DILocalVariable(name: "s",{{.*}} line: 3, ; Index: llvm/test/DebugInfo/X86/sroasplit-4.ll =================================================================== --- llvm/test/DebugInfo/X86/sroasplit-4.ll +++ llvm/test/DebugInfo/X86/sroasplit-4.ll @@ -2,11 +2,11 @@ ; ; Test that recursively splitting an alloca updates the debug info correctly. ; CHECK: %[[T:.*]] = load i64, i64* @t, align 8 -; CHECK: call void @llvm.dbg.value(metadata i64 %[[T]], metadata ![[Y:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)) +; CHECK: call void @llvm.dbg.value(metadata i64 %[[T]], metadata ![[Y:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64) ; CHECK: %[[T1:.*]] = load i64, i64* @t, align 8 -; CHECK: call void @llvm.dbg.value(metadata i64 %[[T1]], metadata ![[Y]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)) -; CHECK: call void @llvm.dbg.value(metadata i64 %[[T]], metadata ![[R:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 64)) -; CHECK: call void @llvm.dbg.value(metadata i64 %[[T1]], metadata ![[R]], metadata !DIExpression(DW_OP_LLVM_fragment, 256, 64)) +; CHECK: call void @llvm.dbg.value(metadata i64 %[[T1]], metadata ![[Y]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64) +; CHECK: call void @llvm.dbg.value(metadata i64 %[[T]], metadata ![[R:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 64) +; CHECK: call void @llvm.dbg.value(metadata i64 %[[T1]], metadata ![[R]], metadata !DIExpression(DW_OP_LLVM_fragment, 256, 64) ; ; struct p { ; __SIZE_TYPE__ s; Index: llvm/test/Instrumentation/HWAddressSanitizer/dbg-value-tag-offset.ll =================================================================== --- llvm/test/Instrumentation/HWAddressSanitizer/dbg-value-tag-offset.ll +++ llvm/test/Instrumentation/HWAddressSanitizer/dbg-value-tag-offset.ll @@ -8,13 +8,13 @@ %2 = alloca i32, align 4 %3 = bitcast i32* %1 to i8*, !dbg !21 %4 = bitcast i32* %2 to i8*, !dbg !21 -; CHECK: call void @llvm.dbg.value(metadata i32 1, {{.*}}, metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 1, {{.*}}, metadata !DIExpression() call void @llvm.dbg.value(metadata i32 1, metadata !20, metadata !DIExpression()), !dbg !22 store i32 1, i32* %2, align 4, !dbg !23, !tbaa !24 -; CHECK: call void @llvm.dbg.value(metadata i32* {{.*}}, metadata !DIExpression(DW_OP_LLVM_tag_offset, 0, DW_OP_deref)) +; CHECK: call void @llvm.dbg.value(metadata i32* {{.*}}, metadata !DIExpression(DW_OP_LLVM_tag_offset, 0, DW_OP_deref) call void @llvm.dbg.value(metadata i32* %1, metadata !18, metadata !DIExpression(DW_OP_deref)), !dbg !22 call void @use(i8* nonnull %3), !dbg !28 -; CHECK: call void @llvm.dbg.value(metadata i32* {{.*}}, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128, DW_OP_deref)) +; CHECK: call void @llvm.dbg.value(metadata i32* {{.*}}, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128, DW_OP_deref) call void @llvm.dbg.value(metadata i32* %2, metadata !20, metadata !DIExpression(DW_OP_deref)), !dbg !22 call void @use(i8* nonnull %4), !dbg !29 ret void, !dbg !30 Index: llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll =================================================================== --- llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll +++ llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll @@ -21,7 +21,7 @@ define internal void @bar(%p_t %p) { ; CHECK-LABEL: define {{[^@]+}}@bar() -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16* undef, metadata !3, metadata !DIExpression()), !dbg !5 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16* undef, metadata !3, metadata !DIExpression(), metadata i16* undef, metadata !DIExpression()), !dbg !5 ; CHECK-NEXT: ret void ; call void @llvm.dbg.value(metadata %p_t %p, metadata !4, metadata !5), !dbg !6 @@ -63,8 +63,8 @@ define internal i32 @callee({i32, i32}* %ptr) !dbg !7 { ; CHECK-LABEL: define {{[^@]+}}@callee ; CHECK-SAME: (i32 [[PTR_0_1_VAL:%.*]]) !dbg !6 -; CHECK-NEXT: call void @llvm.dbg.value(metadata { i32, i32 }* undef, metadata !7, metadata !DIExpression()), !dbg !8 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PTR_0_1_VAL]], metadata !7, metadata !DIExpression()), !dbg !8 +; CHECK-NEXT: call void @llvm.dbg.value(metadata { i32, i32 }* undef, metadata !7, metadata !DIExpression(), metadata { i32, i32 }* undef, metadata !DIExpression()), !dbg !8 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PTR_0_1_VAL]], metadata !7, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !8 ; CHECK-NEXT: ret i32 [[PTR_0_1_VAL]] ; call void @llvm.dbg.value(metadata {i32, i32}* %ptr, metadata !8, metadata !9), !dbg !10 Index: llvm/test/Transforms/BDCE/basic.ll =================================================================== --- llvm/test/Transforms/BDCE/basic.ll +++ llvm/test/Transforms/BDCE/basic.ll @@ -387,7 +387,7 @@ entry: %call = tail call signext i32 @foo(i32 signext 5) #0 %and = and i32 %call, 33554432 -; DEBUGIFY: call void @llvm.dbg.value(metadata i32 %call, metadata {{.*}}, metadata !DIExpression(DW_OP_constu, 33554432, DW_OP_and, DW_OP_stack_value)) +; DEBUGIFY: call void @llvm.dbg.value(metadata i32 %call, metadata {{.*}}, metadata !DIExpression(DW_OP_constu, 33554432, DW_OP_and, DW_OP_stack_value), metadata i32 undef, metadata !DIExpression()) %cast = trunc i32 %call to i16 ret i16 %cast } Index: llvm/test/Transforms/BDCE/dbg-multipleuses.ll =================================================================== --- llvm/test/Transforms/BDCE/dbg-multipleuses.ll +++ llvm/test/Transforms/BDCE/dbg-multipleuses.ll @@ -8,7 +8,7 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: tail call void (...) @h() ; CHECK-NEXT: %[[CALL:.*]] = tail call i32 (...) @g() -; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 %[[CALL:.*]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %[[CALL:.*]] define void @f() !dbg !6 { entry: Index: llvm/test/Transforms/BDCE/pr26587.ll =================================================================== --- llvm/test/Transforms/BDCE/pr26587.ll +++ llvm/test/Transforms/BDCE/pr26587.ll @@ -8,7 +8,7 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: tail call void (...) @h() ; CHECK-NEXT: %[[CALL:.*]] = tail call i32 (...) @g() -; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 %[[CALL:.*]] +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %[[CALL:.*]] define void @f() !dbg !6 { entry: Index: llvm/test/Transforms/CodeGenPrepare/sink-shift-and-trunc.ll =================================================================== --- llvm/test/Transforms/CodeGenPrepare/sink-shift-and-trunc.ll +++ llvm/test/Transforms/CodeGenPrepare/sink-shift-and-trunc.ll @@ -11,7 +11,7 @@ %x.sroa.3.0.extract.shift = lshr i64 %arg1, 32, !dbg !37 call void @llvm.dbg.value(metadata i64 %x.sroa.3.0.extract.shift, metadata !13, metadata !DIExpression()), !dbg !37 -; CHECK: call void @llvm.dbg.value(metadata i64 %arg1, metadata {{.*}}, metadata !DIExpression(DW_OP_constu, 32, DW_OP_shr, DW_OP_stack_value)), !dbg [[shift2_loc:![0-9]+]] +; CHECK: call void @llvm.dbg.value(metadata i64 %arg1, metadata {{.*}}, metadata !DIExpression(DW_OP_constu, 32, DW_OP_shr, DW_OP_stack_value), metadata i64 undef, metadata !DIExpression()), !dbg [[shift2_loc:![0-9]+]] %x.sroa.5.0.extract.shift = lshr i64 %arg1, 48, !dbg !38 %tobool = icmp eq i64 %x.sroa.5.0.extract.shift, 0, !dbg !39 Index: llvm/test/Transforms/DCE/basic.ll =================================================================== --- llvm/test/Transforms/DCE/basic.ll +++ llvm/test/Transforms/DCE/basic.ll @@ -4,9 +4,9 @@ ; CHECK-LABEL: @test define void @test() { %add = add i32 1, 2 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 1, metadata [[add:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 1, metadata [[add:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2, DW_OP_stack_value), metadata i32 undef, metadata !DIExpression()) %sub = sub i32 %add, 1 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 1, metadata [[sub:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2, DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 1, metadata [[sub:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2, DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value), metadata i32 undef, metadata !DIExpression()) ; CHECK-NEXT: ret void ret void } Index: llvm/test/Transforms/DCE/dbg-value-removal.ll =================================================================== --- llvm/test/Transforms/DCE/dbg-value-removal.ll +++ llvm/test/Transforms/DCE/dbg-value-removal.ll @@ -9,29 +9,29 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[BB0:%.*]] ; CHECK: bb0: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 13, metadata !13, metadata !DIExpression()), !dbg !16 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 14, metadata !14, metadata !DIExpression()), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 13, metadata !13, metadata !DIExpression()), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 12, metadata !12, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 13, metadata !13, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !16 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 14, metadata !14, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 13, metadata !13, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 12, metadata !12, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !18 ; CHECK-NEXT: br label [[BB1:%.*]] ; CHECK: bb1: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1:%.*]], metadata !14, metadata !DIExpression()), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 888, metadata !13, metadata !DIExpression()), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A2:%.*]], metadata !12, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1:%.*]], metadata !14, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 888, metadata !13, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A2:%.*]], metadata !12, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !18 ; CHECK-NEXT: [[T1:%.*]] = call i16 @bar(i16 0) -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[T1]], metadata !13, metadata !DIExpression()), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A2]], metadata !12, metadata !DIExpression(DW_OP_constu, 2, DW_OP_shr, DW_OP_stack_value)), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[T1]], metadata !13, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A2]], metadata !12, metadata !DIExpression(DW_OP_constu, 2, DW_OP_shr, DW_OP_stack_value), metadata i16 undef, metadata !DIExpression()), !dbg !18 ; CHECK-NEXT: br label [[BB2:%.*]] ; CHECK: bb2: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8)), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 8, 8)), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8), metadata i16 undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 8, 8), metadata i16 undef, metadata !DIExpression()), !dbg !18 ; CHECK-NEXT: [[T2:%.*]] = call i16 @bar(i16 [[T1]]) -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[T2]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8)), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 8, 8)), !dbg !19 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[T2]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8), metadata i16 undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 8, 8), metadata i16 undef, metadata !DIExpression()), !dbg !19 ; CHECK-NEXT: br label [[BB3:%.*]] ; CHECK: bb3: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8)), !dbg !19 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8), metadata i16 undef, metadata !DIExpression()), !dbg !19 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[A1]], metadata !13, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !18 ; CHECK-NEXT: br label [[EXIT:%.*]] ; CHECK: exit: ; CHECK-NEXT: ret i16 [[T2]] Index: llvm/test/Transforms/DeadArgElim/dbginfo-preserve-dbgloc.ll =================================================================== --- llvm/test/Transforms/DeadArgElim/dbginfo-preserve-dbgloc.ll +++ llvm/test/Transforms/DeadArgElim/dbginfo-preserve-dbgloc.ll @@ -36,9 +36,9 @@ define internal zeroext i1 @f1(i1 zeroext %is_y, %struct.Channel* %str) #4 !dbg !34 { entry: %frombool = zext i1 %is_y to i8 -; CHECK: call void @llvm.dbg.value(metadata i1 %is_y, metadata !39, metadata !DIExpression()), !dbg !42 +; CHECK: call void @llvm.dbg.value(metadata i1 %is_y, metadata !39, metadata !DIExpression(), metadata i1 undef, metadata !DIExpression()), !dbg !42 call void @llvm.dbg.value(metadata i1 %is_y, metadata !39, metadata !DIExpression()), !dbg !42 -; CHECK: call void @llvm.dbg.value(metadata %struct.Channel* %str, metadata !40, metadata !DIExpression()), !dbg !43 +; CHECK: call void @llvm.dbg.value(metadata %struct.Channel* %str, metadata !40, metadata !DIExpression(), metadata %struct.Channel* undef, metadata !DIExpression()), !dbg !43 call void @llvm.dbg.value(metadata %struct.Channel* %str, metadata !40, metadata !DIExpression()), !dbg !43 call void @llvm.dbg.value(metadata %struct.Channel* null, metadata !41, metadata !DIExpression()), !dbg !44 %tobool = icmp ne %struct.Channel* %str, null, !dbg !45 Index: llvm/test/Transforms/DeadArgElim/dbginfo-update-dbgval.ll =================================================================== --- llvm/test/Transforms/DeadArgElim/dbginfo-update-dbgval.ll +++ llvm/test/Transforms/DeadArgElim/dbginfo-update-dbgval.ll @@ -24,7 +24,7 @@ ; Function Attrs: noinline nounwind uwtable define dso_local void @f2(i32 %k) local_unnamed_addr !dbg !11 { entry: -; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata !15, metadata !DIExpression()), !dbg !16 +; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata !15, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !16 call void @llvm.dbg.value(metadata i32 %k, metadata !15, metadata !DIExpression()), !dbg !16 %0 = load i32, i32* @s, align 4, !dbg !17 %inc = add nsw i32 %0, 1, !dbg !17 Index: llvm/test/Transforms/DeadStoreElimination/MSSA/debuginfo.ll =================================================================== --- llvm/test/Transforms/DeadStoreElimination/MSSA/debuginfo.ll +++ llvm/test/Transforms/DeadStoreElimination/MSSA/debuginfo.ll @@ -10,10 +10,10 @@ ; Check that all four original local variables have their values preserved. ; CHECK-LABEL: @test_salvage( ; CHECK-NEXT: malloc -; CHECK-NEXT: @llvm.dbg.value(metadata i8* %p, metadata ![[p:.*]], metadata !DIExpression()) +; CHECK-NEXT: @llvm.dbg.value(metadata i8* %p, metadata ![[p:.*]], metadata !DIExpression(), metadata i8* undef, metadata !DIExpression()) ; CHECK-NEXT: bitcast -; CHECK-NEXT: @llvm.dbg.value(metadata i32* %P, metadata ![[P:.*]], metadata !DIExpression()) -; CHECK-NEXT: @llvm.dbg.value(metadata i32 %arg, metadata ![[DEAD:.*]], metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)) +; CHECK-NEXT: @llvm.dbg.value(metadata i32* %P, metadata ![[P:.*]], metadata !DIExpression(), metadata i32* undef, metadata !DIExpression()) +; CHECK-NEXT: @llvm.dbg.value(metadata i32 %arg, metadata ![[DEAD:.*]], metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value), metadata i32 undef, metadata !DIExpression()) ; CHECK-NEXT: call void @test_f() ; CHECK-NEXT: store i32 0, i32* %P Index: llvm/test/Transforms/DeadStoreElimination/debuginfo.ll =================================================================== --- llvm/test/Transforms/DeadStoreElimination/debuginfo.ll +++ llvm/test/Transforms/DeadStoreElimination/debuginfo.ll @@ -10,10 +10,10 @@ ; Check that all four original local variables have their values preserved. ; CHECK-LABEL: @test_salvage( ; CHECK-NEXT: malloc -; CHECK-NEXT: @llvm.dbg.value(metadata i8* %p, metadata ![[p:.*]], metadata !DIExpression()) +; CHECK-NEXT: @llvm.dbg.value(metadata i8* %p, metadata ![[p:.*]], metadata !DIExpression(), metadata i8* undef, metadata !DIExpression()) ; CHECK-NEXT: bitcast -; CHECK-NEXT: @llvm.dbg.value(metadata i32* %P, metadata ![[P:.*]], metadata !DIExpression()) -; CHECK-NEXT: @llvm.dbg.value(metadata i32 %arg, metadata ![[DEAD:.*]], metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)) +; CHECK-NEXT: @llvm.dbg.value(metadata i32* %P, metadata ![[P:.*]], metadata !DIExpression(), metadata i32* undef, metadata !DIExpression()) +; CHECK-NEXT: @llvm.dbg.value(metadata i32 %arg, metadata ![[DEAD:.*]], metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value), metadata i32 undef, metadata !DIExpression()) ; CHECK-NEXT: call void @test_f() ; CHECK-NEXT: store i32 0, i32* %P Index: llvm/test/Transforms/EarlyCSE/debug-info-undef.ll =================================================================== --- llvm/test/Transforms/EarlyCSE/debug-info-undef.ll +++ llvm/test/Transforms/EarlyCSE/debug-info-undef.ll @@ -10,7 +10,7 @@ %0 = load i8, i8* @a, align 1, !dbg !19, !tbaa !20 %conv = sext i8 %0 to i16, !dbg !19 -; CHECK: call void @llvm.dbg.value(metadata i8 %0, metadata !17, metadata !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 16, DW_ATE_signed, DW_OP_stack_value)), !dbg !18 +; CHECK: call void @llvm.dbg.value(metadata i8 %0, metadata !17, metadata !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 16, DW_ATE_signed, DW_OP_stack_value), metadata i16 undef, metadata !DIExpression()), !dbg !18 ; CHECK-NEXT: call i32 (...) @optimize_me_not() call void @llvm.dbg.value(metadata i16 %conv, metadata !17, metadata !DIExpression()), !dbg !18 Index: llvm/test/Transforms/EarlyCSE/debuginfo-dce.ll =================================================================== --- llvm/test/Transforms/EarlyCSE/debuginfo-dce.ll +++ llvm/test/Transforms/EarlyCSE/debuginfo-dce.ll @@ -7,7 +7,7 @@ %0 = call i64 @llvm.ctpop.i64(i64 0), !dbg !14 %1 = inttoptr i64 %0 to i32*, !dbg !14 call void @llvm.dbg.value(metadata i32* %1, i64 0, metadata !11, metadata !13), !dbg !14 -; CHECK: call void @llvm.dbg.value(metadata i64 0, metadata !11, metadata !DIExpression()), !dbg !13 +; CHECK: call void @llvm.dbg.value(metadata i64 0, metadata !11, metadata !DIExpression(), metadata i32* undef, metadata !DIExpression()), !dbg !13 %call = call i32* (...) @baa(), !dbg !15 %2 = ptrtoint i32* %call to i64, !dbg !16 %3 = inttoptr i64 %2 to i32*, !dbg !16 Index: llvm/test/Transforms/GVN/PRE/phi-translate-2.ll =================================================================== --- llvm/test/Transforms/GVN/PRE/phi-translate-2.ll +++ llvm/test/Transforms/GVN/PRE/phi-translate-2.ll @@ -141,8 +141,8 @@ ; CHECK: br label %if.end3 ; CHECK: if.end3: ; CHECK: %[[PREPHI:.*]] = phi i64 [ %sub.ptr.sub, %if.else ], [ %[[SUB]], %if.then2 ], [ %sub.ptr.sub, %entry ] -; CHECK: call void @llvm.dbg.value(metadata i32* %p.0, metadata [[var_p0:![0-9]+]], metadata !DIExpression()) -; CHECK: call void @llvm.dbg.value(metadata i64 %sub.ptr.rhs.cast5.pre-phi, metadata [[var_sub_ptr:![0-9]+]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32* %p.0, metadata [[var_p0:![0-9]+]], metadata !DIExpression(), metadata i32* undef, metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i64 %sub.ptr.rhs.cast5.pre-phi, metadata [[var_sub_ptr:![0-9]+]], metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()) ; CHECK: %[[DIV:.*]] = ashr exact i64 %[[PREPHI]], 2 ; CHECK: ret i64 %[[DIV]] Index: llvm/test/Transforms/HotColdSplit/transfer-debug-info.ll =================================================================== --- llvm/test/Transforms/HotColdSplit/transfer-debug-info.ll +++ llvm/test/Transforms/HotColdSplit/transfer-debug-info.ll @@ -23,7 +23,7 @@ ; CHECK-NEXT: call void @sink(i32 [[ADD1]]), !dbg [[LINE1:![0-9]+]] ; - llvm.dbg.value intrinsics for values local to @foo.cold.1 are preserved -; CHECK-NEXT: llvm.dbg.value(metadata i32 [[ADD1]], metadata [[VAR1:![0-9]+]], metadata !DIExpression()), !dbg [[LINE1]] +; CHECK-NEXT: llvm.dbg.value(metadata i32 [[ADD1]], metadata [[VAR1:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg [[LINE1]] ; - Expressions inside of dbg.value intrinsics are preserved ; CHECK-NEXT: llvm.dbg.value(metadata i32 [[ADD1]], metadata [[VAR1]], metadata !DIExpression(DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value) Index: llvm/test/Transforms/IndVarSimplify/X86/indvar-debug-value.ll =================================================================== --- llvm/test/Transforms/IndVarSimplify/X86/indvar-debug-value.ll +++ llvm/test/Transforms/IndVarSimplify/X86/indvar-debug-value.ll @@ -18,7 +18,7 @@ ; CHECK: @main ; CHECK: llvm.dbg.value(metadata i32 1, metadata [[METADATA_IDX1:![0-9]+]] ; CHECK: %[[VAR_NAME:.*]] = add nuw nsw i64 -; CHECK: llvm.dbg.value(metadata i64 %[[VAR_NAME]], metadata [[METADATA_IDX1]], metadata !DIExpression()) +; CHECK: llvm.dbg.value(metadata i64 %[[VAR_NAME]], metadata [[METADATA_IDX1]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) ; CHECK: DICompileUnit ; CHECK: [[METADATA_IDX1]] = !DILocalVariable(name: "ArgIndex" Index: llvm/test/Transforms/IndVarSimplify/X86/indvar-debug-value2.ll =================================================================== --- llvm/test/Transforms/IndVarSimplify/X86/indvar-debug-value2.ll +++ llvm/test/Transforms/IndVarSimplify/X86/indvar-debug-value2.ll @@ -18,7 +18,7 @@ ; CHECK: @main ; CHECK: llvm.dbg.value(metadata i32 1, metadata [[METADATA_IDX1:![0-9]+]] ; CHECK: %[[VAR_NAME:.*]] = add nuw nsw i64 -; CHECK: llvm.dbg.value(metadata i64 %[[VAR_NAME]], metadata [[METADATA_IDX1]], metadata !DIExpression()) +; CHECK: llvm.dbg.value(metadata i64 %[[VAR_NAME]], metadata [[METADATA_IDX1]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) ; CHECK: DICompileUnit ; CHECK: [[METADATA_IDX1]] = !DILocalVariable(name: "ArgIndex" Index: llvm/test/Transforms/IndVarSimplify/X86/scev-phi-debug-info.ll =================================================================== --- llvm/test/Transforms/IndVarSimplify/X86/scev-phi-debug-info.ll +++ llvm/test/Transforms/IndVarSimplify/X86/scev-phi-debug-info.ll @@ -14,7 +14,7 @@ for.cond: ; preds = %for.body, %entry ; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] - ; CHECK: call void @llvm.dbg.value(metadata i64 %indvars.iv, metadata !23, metadata !DIExpression()), !dbg !24 + ; CHECK: call void @llvm.dbg.value(metadata i64 %indvars.iv, metadata !23, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !24 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] tail call void @llvm.dbg.value(metadata i32 %i.0, metadata !23, metadata !DIExpression()), !dbg !24 %cmp = icmp slt i32 %i.0, 32, !dbg !24 Index: llvm/test/Transforms/Inline/local-as-metadata-undominated-use.ll =================================================================== --- llvm/test/Transforms/Inline/local-as-metadata-undominated-use.ll +++ llvm/test/Transforms/Inline/local-as-metadata-undominated-use.ll @@ -21,7 +21,7 @@ entry: ; Although the inliner shouldn't crash, it can't be expected to get the ; "correct" SSA value since its assumptions have been violated. -; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ![[EMPTY:[0-9]+]], +; CHECK-NEXT: call void @llvm.dbg.value(metadata ![[EMPTY:[0-9]+]], ; CHECK-NEXT: %{{.*}} = add nsw %call = tail call i32 @foo(i32 %i) ret i32 %call Index: llvm/test/Transforms/InstCombine/assume.ll =================================================================== --- llvm/test/Transforms/InstCombine/assume.ll +++ llvm/test/Transforms/InstCombine/assume.ll @@ -377,10 +377,10 @@ define void @debug_interference(i8 %x) { ; CHECK-LABEL: @debug_interference( ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 [[X:%.*]], 0 -; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 5, metadata !7, metadata !DIExpression()), !dbg !9 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 5, metadata !7, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !9 ; CHECK-NEXT: tail call void @llvm.assume(i1 false) -; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 5, metadata !7, metadata !DIExpression()), !dbg !9 -; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 5, metadata !7, metadata !DIExpression()), !dbg !9 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 5, metadata !7, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !9 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 5, metadata !7, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !9 ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP2]]) ; CHECK-NEXT: ret void ; Index: llvm/test/Transforms/InstCombine/cast-mul-select.ll =================================================================== --- llvm/test/Transforms/InstCombine/cast-mul-select.ll +++ llvm/test/Transforms/InstCombine/cast-mul-select.ll @@ -13,8 +13,8 @@ ; we preserve the debug information in the resulting ; instruction. ; DBGINFO-LABEL: @mul( -; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i32 %x, {{.*}} !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value)) -; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i32 %y, {{.*}} !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value)) +; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i32 %x, {{.*}} !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value), metadata i8 undef, metadata !DIExpression()) +; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i32 %y, {{.*}} !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value), metadata i8 undef, metadata !DIExpression()) ; DBGINFO-NEXT: [[C:%.*]] = mul i32 {{.*}} ; DBGINFO-NEXT: [[D:%.*]] = and i32 {{.*}} ; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i32 [[C]] @@ -175,7 +175,7 @@ ; Check that we don't drop debug info when a zext is removed. define i1 @foo(i1 zeroext %b) { ; DBGINFO-LABEL: @foo( -; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i1 %b, {{.*}} !DIExpression(DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value)) +; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i1 %b, {{.*}} !DIExpression(DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value), metadata i8 undef, metadata !DIExpression()) ; DBGINFO-NEXT: ret i1 %b %frombool = zext i1 %b to i8 Index: llvm/test/Transforms/InstCombine/cast-set-preserve-signed-dbg-val.ll =================================================================== --- llvm/test/Transforms/InstCombine/cast-set-preserve-signed-dbg-val.ll +++ llvm/test/Transforms/InstCombine/cast-set-preserve-signed-dbg-val.ll @@ -20,7 +20,7 @@ call void @llvm.dbg.value(metadata i16 %D, metadata !38, metadata !DIExpression()), !dbg !42 ; The dbg.value for a truncate should simply point to the result of the 16-bit 'and'. - ; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[and]], metadata [[D:![0-9]+]], metadata !DIExpression()) + ; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[and]], metadata [[D:![0-9]+]], metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()) ret i16 %D, !dbg !43 ; CHECK-NEXT: ret i16 [[and]] Index: llvm/test/Transforms/InstCombine/debuginfo-dce.ll =================================================================== --- llvm/test/Transforms/InstCombine/debuginfo-dce.ll +++ llvm/test/Transforms/InstCombine/debuginfo-dce.ll @@ -48,7 +48,7 @@ ; CHECK: define void @salvage_bitcast ; CHECK-NEXT: entry: ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, -; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 0)) +; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 0) store i8* %1, i8** %im_not_dead, align 8 ret void, !dbg !23 } @@ -62,7 +62,7 @@ ; CHECK: define void @salvage_gep0 ; CHECK-NEXT: entry: ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, -; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 0, DW_OP_stack_value)) +; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 0, DW_OP_stack_value) store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8 ret void, !dbg !26 } @@ -76,7 +76,7 @@ ; CHECK: define void @salvage_gep1 ; CHECK-NEXT: entry: ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, -; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32)) +; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32) store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8 ret void, !dbg !29 } @@ -90,7 +90,7 @@ ; CHECK: define void @salvage_gep2 ; CHECK-NEXT: entry: ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, -; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value)) +; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value) store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8 ret void, !dbg !32 } Index: llvm/test/Transforms/InstCombine/debuginfo-dce2.ll =================================================================== --- llvm/test/Transforms/InstCombine/debuginfo-dce2.ll +++ llvm/test/Transforms/InstCombine/debuginfo-dce2.ll @@ -27,9 +27,9 @@ } ; CHECK-LABEL: define void @f(i8* %p) -; CHECK: call void @llvm.dbg.value(metadata i8* %p, metadata ![[P_VAR:[0-9]+]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i8* %p, metadata ![[P_VAR:[0-9]+]], metadata !DIExpression(), metadata i8* undef, metadata !DIExpression()) ; CHECK-NOT: bitcast -; CHECK: call void @llvm.dbg.value(metadata i8* %p, metadata ![[Q_VAR:[0-9]+]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i8* %p, metadata ![[Q_VAR:[0-9]+]], metadata !DIExpression(), metadata i32* undef, metadata !DIExpression()) ; CHECK-NOT: bitcast ; CHECK: ret void Index: llvm/test/Transforms/InstCombine/debuginfo-sink.ll =================================================================== --- llvm/test/Transforms/InstCombine/debuginfo-sink.ll +++ llvm/test/Transforms/InstCombine/debuginfo-sink.ll @@ -10,7 +10,7 @@ ; ; CHECK-LABEL: define i32 @foo(i32* ; CHECK: call void @llvm.dbg.value(metadata i32* %a, metadata !{{[0-9]+}}, -; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value)) +; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value) ; CHECK-NEXT: br label %sink1 define i32 @foo(i32 *%a) !dbg !7 { @@ -22,7 +22,7 @@ sink1: ; CHECK-LABEL: sink1: ; CHECK: call void @llvm.dbg.value(metadata i32* %gep, -; CHECK-SAME: metadata !{{[0-9]+}}, metadata !DIExpression()) +; CHECK-SAME: metadata !{{[0-9]+}}, metadata !DIExpression() ; CHECK-NEXT: load %0 = load i32, i32* %gep, align 4, !dbg !15 ret i32 %0, !dbg !15 @@ -45,7 +45,7 @@ sink2: ; CHECK-LABEL: sink2: ; CHECK: call void @llvm.dbg.value(metadata i32* %gep, -; CHECK-SAME: metadata !{{[0-9]+}}, metadata !DIExpression()) +; CHECK-SAME: metadata !{{[0-9]+}}, metadata !DIExpression() ; CHECK-NEXT: load ; CHECK-NEXT: ret %0 = load i32, i32* %gep Index: llvm/test/Transforms/InstCombine/debuginfo-variables.ll =================================================================== --- llvm/test/Transforms/InstCombine/debuginfo-variables.ll +++ llvm/test/Transforms/InstCombine/debuginfo-variables.ll @@ -5,8 +5,8 @@ define i64 @test_sext_zext(i16 %A) { ; CHECK-LABEL: @test_sext_zext( ; CHECK-NEXT: [[C2:%.*]] = zext i16 %A to i64 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression()) -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression() +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression() %c1 = zext i16 %A to i32 %c2 = sext i32 %c1 to i64 ret i64 %c2 @@ -15,9 +15,9 @@ define i64 @test_used_sext_zext(i16 %A) { ; CHECK-LABEL: @test_used_sext_zext( ; CHECK-NEXT: [[C1:%.*]] = zext i16 %A to i32 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[C1]], {{.*}}, metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[C1]], {{.*}}, metadata !DIExpression() ; CHECK-NEXT: [[C2:%.*]] = zext i16 %A to i64 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression() ; CHECK-NEXT: call void @escape32(i32 %c1) ; CHECK-NEXT: ret i64 %c2 %c1 = zext i16 %A to i32 @@ -29,8 +29,8 @@ define i32 @test_cast_select(i1 %cond) { ; CHECK-LABEL: @test_cast_select( ; CHECK-NEXT: [[sel:%.*]] = select i1 %cond, i32 3, i32 5 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[sel]], {{.*}}, metadata !DIExpression()) -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[sel]], {{.*}}, metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[sel]], {{.*}}, metadata !DIExpression() +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[sel]], {{.*}}, metadata !DIExpression() ; CHECK-NEXT: ret i32 [[sel]] %sel = select i1 %cond, i16 3, i16 5 %cast = zext i16 %sel to i32 @@ -39,84 +39,84 @@ define void @test_or(i64 %A) { ; CHECK-LABEL: @test_or( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 256, DW_OP_or, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 256, DW_OP_or, DW_OP_stack_value) %1 = or i64 %A, 256 ret void } define void @test_xor(i32 %A) { ; CHECK-LABEL: @test_xor( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 1, DW_OP_xor, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 1, DW_OP_xor, DW_OP_stack_value) %1 = xor i32 %A, 1 ret void } define void @test_sub_neg(i64 %A) { ; CHECK-LABEL: @test_sub_neg( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value) %1 = sub i64 %A, -1 ret void } define void @test_sub_pos(i64 %A) { ; CHECK-LABEL: @test_sub_pos( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value) %1 = sub i64 %A, 1 ret void } define void @test_shl(i64 %A) { ; CHECK-LABEL: @test_shl( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shl, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shl, DW_OP_stack_value) %1 = shl i64 %A, 7 ret void } define void @test_lshr(i64 %A) { ; CHECK-LABEL: @test_lshr( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shr, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shr, DW_OP_stack_value) %1 = lshr i64 %A, 7 ret void } define void @test_ashr(i64 %A) { ; CHECK-LABEL: @test_ashr( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shra, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shra, DW_OP_stack_value) %1 = ashr i64 %A, 7 ret void } define void @test_mul(i64 %A) { ; CHECK-LABEL: @test_mul( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_mul, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_mul, DW_OP_stack_value) %1 = mul i64 %A, 7 ret void } define void @test_sdiv(i64 %A) { ; CHECK-LABEL: @test_sdiv( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_div, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_div, DW_OP_stack_value) %1 = sdiv i64 %A, 7 ret void } define void @test_srem(i64 %A) { ; CHECK-LABEL: @test_srem( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_mod, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_mod, DW_OP_stack_value) %1 = srem i64 %A, 7 ret void } define void @test_ptrtoint(i64* %P) { ; CHECK-LABEL: @test_ptrtoint -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64* %P, {{.*}}, metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64* %P, {{.*}}, metadata !DIExpression() %1 = ptrtoint i64* %P to i64 ret void } define void @test_and(i64 %A) { ; CHECK-LABEL: @test_and( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 256, DW_OP_and, DW_OP_stack_value)) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 256, DW_OP_and, DW_OP_stack_value) %1 = and i64 %A, 256 ret void } Index: llvm/test/Transforms/InstCombine/debuginfo_add.ll =================================================================== --- llvm/test/Transforms/InstCombine/debuginfo_add.ll +++ llvm/test/Transforms/InstCombine/debuginfo_add.ll @@ -36,8 +36,8 @@ ; The add is later eliminated, so we verify that the dbg.value is salvaged by using DW_OP_minus. ; CHECK-LABEL: for.body.lr.ph: ; CHECK-NEXT: %0 = load - ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %0, metadata !26, metadata !DIExpression(DW_OP_constu, 4096, DW_OP_minus, DW_OP_stack_value)), !dbg ! - ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %0, metadata !25, metadata !DIExpression()), !dbg ! + ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %0, metadata !26, metadata !DIExpression(DW_OP_constu, 4096, DW_OP_minus, DW_OP_stack_value), metadata i64 undef, metadata !DIExpression()), !dbg ! + ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %0, metadata !25, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg ! br label %for.body, !dbg !32 for.body: ; preds = %for.body.lr.ph, %for.body @@ -49,7 +49,7 @@ %sub2 = add i32 %head_size.09, -4096, !dbg !37 %offset.0 = add i64 %offset.010, -4096 tail call void @llvm.dbg.value(metadata i64 %offset.0, metadata !26, metadata !DIExpression()), !dbg !30 - ; CHECK: call void @llvm.dbg.value(metadata i64 %offset.010, metadata !26, metadata !DIExpression(DW_OP_constu, 4096, DW_OP_minus, DW_OP_stack_value)), !dbg ! + ; CHECK: call void @llvm.dbg.value(metadata i64 %offset.010, metadata !26, metadata !DIExpression(DW_OP_constu, 4096, DW_OP_minus, DW_OP_stack_value), metadata i64 undef, metadata !DIExpression()), !dbg ! tail call void @llvm.dbg.value(metadata i32 %sub2, metadata !23, metadata !DIExpression()), !dbg !31 %tobool = icmp eq i32 %sub2, 0, !dbg !32 br i1 %tobool, label %for.end, label %for.body, !dbg !32, !llvm.loop !38 Index: llvm/test/Transforms/InstCombine/lower-dbg-declare.ll =================================================================== --- llvm/test/Transforms/InstCombine/lower-dbg-declare.ll +++ llvm/test/Transforms/InstCombine/lower-dbg-declare.ll @@ -28,14 +28,14 @@ store i32 0, i32* %retval, align 4 %0 = bitcast i32* %d1 to i8*, !dbg !17 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #4, !dbg !17 -; CHECK: dbg.value(metadata i32 42, metadata [[METADATA_IDX1:![0-9]+]], metadata !DIExpression()) +; CHECK: dbg.value(metadata i32 42, metadata [[METADATA_IDX1:![0-9]+]], metadata !DIExpression() ; CHECK-NEXT: store call void @llvm.dbg.declare(metadata i32* %d1, metadata !16, metadata !DIExpression()), !dbg !17 store i32 42, i32* %d1, align 4, !dbg !17 br label %while.cond, !dbg !22 while.cond: ; preds = %while.body, %entry -; CHECK: dbg.value(metadata i32 %1, metadata [[METADATA_IDX1]], metadata !DIExpression()) +; CHECK: dbg.value(metadata i32 %1, metadata [[METADATA_IDX1]], metadata !DIExpression() ; CHECK-NEXT: call zeroext i1 @_ZL5emptyi %1 = load i32, i32* %d1, align 4, !dbg !22 %call = call zeroext i1 @_ZL5emptyi(i32 %1), !dbg !22 @@ -43,7 +43,7 @@ br i1 %lnot, label %while.body, label %while.end, !dbg !22 while.body: ; preds = %while.cond -; CHECK: dbg.value(metadata i32* %d1, metadata [[METADATA_IDX1]], metadata !DIExpression(DW_OP_deref)) +; CHECK: dbg.value(metadata i32* %d1, metadata [[METADATA_IDX1]], metadata !DIExpression(DW_OP_deref) ; CHECK-NEXT: call void @_ZL6escapeRi call void @_ZL6escapeRi(i32* dereferenceable(4) %d1), !dbg !23 br label %while.cond, !dbg !22, !llvm.loop !24 Index: llvm/test/Transforms/InstCombine/unavailable-debug.ll =================================================================== --- llvm/test/Transforms/InstCombine/unavailable-debug.ll +++ llvm/test/Transforms/InstCombine/unavailable-debug.ll @@ -2,7 +2,7 @@ ; Make sure to update the debug value after dead code elimination. ; CHECK: %call = call signext i8 @b(i32 6), !dbg !39 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i8 %call, metadata !30, metadata !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value)), !dbg !38 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i8 %call, metadata !30, metadata !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value), metadata i32 undef, metadata !DIExpression()), !dbg !38 @e = common local_unnamed_addr global i8 0, align 1, !dbg !0 @c = common local_unnamed_addr global i32 0, align 4, !dbg !6 Index: llvm/test/Transforms/JumpThreading/redundant-dbg-info.ll =================================================================== --- llvm/test/Transforms/JumpThreading/redundant-dbg-info.ll +++ llvm/test/Transforms/JumpThreading/redundant-dbg-info.ll @@ -19,9 +19,9 @@ br i1 %tobool1, label %if.else, label %if.then2, !dbg !23 ; CHECK-LABEL: if.then2: -; CHECK: call void @llvm.dbg.value({{.+}}, metadata ![[B:[0-9]+]], metadata !DIExpression()) -; CHECK: call void @llvm.dbg.value({{.+}}, metadata ![[B:[0-9]+]], metadata !DIExpression()) -; CHECK-NOT: call void @llvm.dbg.value({{.+}}, metadata ![[B]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value({{.+}}, metadata ![[B:[0-9]+]], metadata !DIExpression() +; CHECK: call void @llvm.dbg.value({{.+}}, metadata ![[B:[0-9]+]], metadata !DIExpression() +; CHECK-NOT: call void @llvm.dbg.value({{.+}}, metadata ![[B]], metadata !DIExpression() if.then2: ; preds = %if.end call void @llvm.dbg.value(metadata i32 4, metadata !24, metadata !DIExpression()), !dbg !13 br label %if.end3, !dbg !25 Index: llvm/test/Transforms/LCSSA/rewrite-existing-dbg-values.ll =================================================================== --- llvm/test/Transforms/LCSSA/rewrite-existing-dbg-values.ll +++ llvm/test/Transforms/LCSSA/rewrite-existing-dbg-values.ll @@ -12,16 +12,16 @@ ; CHECK-LABEL: inner.body: ; CHECK: %add = add nsw i32 0, 2 -; CHECK: call void @llvm.dbg.value(metadata i32 %add, metadata [[VAR:![0-9]+]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 %add, metadata [[VAR:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) ; CHECK-LABEL: outer.exit: ; CHECK-NEXT: [[PN:%[^ ]*]] = phi i32 [ %add.lcssa, %outer.latch ] -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PN]], metadata [[VAR]], metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PN]], metadata [[VAR]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) ; CHECK-NEXT: call void @bar(i32 [[PN]]) ; CHECK-LABEL: exit: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PN]], metadata [[VAR]], metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PN]], metadata [[VAR]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) define void @single_exit() !dbg !6 { entry: @@ -59,23 +59,23 @@ ; CHECK-LABEL: for.header: ; CHECK-NEXT: %add = add nsw i32 0, 2 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata [[VAR2:![0-9]+]], metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata [[VAR2:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) ; CHECK-LABEL: for.exit1: ; CHECK-NEXT: [[PN1:%[^ ]*]] = phi i32 [ %add, %for.header ] ; CHECK-NEXT: br label %for.exit1.succ ; CHECK-LABEL: for.exit1.succ: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PN1]], metadata [[VAR2]], metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PN1]], metadata [[VAR2]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) ; CHECK-NEXT: call void @bar(i32 [[PN1]]) ; CHECK-LABEL: for.exit2: ; CHECK-NEXT: [[PN2:%[^ ]*]] = phi i32 [ %add, %for.latch ] -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PN2]], metadata [[VAR2]], metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[PN2]], metadata [[VAR2]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) ; CHECK-NEXT: call void @bar(i32 [[PN2]]) ; CHECK-LABEL: exit: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata [[VAR2]], metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata [[VAR2]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()) define void @multi_exit() !dbg !13 { entry: Index: llvm/test/Transforms/LICM/debug-value.ll =================================================================== --- llvm/test/Transforms/LICM/debug-value.ll +++ llvm/test/Transforms/LICM/debug-value.ll @@ -15,7 +15,7 @@ br i1 undef, label %if.then27, label %if.end.if.end.split_crit_edge.critedge, !dbg !16 if.then27: ; preds = %if.then -; CHECK: tail call void @llvm.dbg.value +; CHECK: call void @llvm.dbg.value tail call void @llvm.dbg.value(metadata double undef, metadata !19, metadata !DIExpression()), !dbg !21 br label %for.body61.us Index: llvm/test/Transforms/LICM/sinking.ll =================================================================== --- llvm/test/Transforms/LICM/sinking.ll +++ llvm/test/Transforms/LICM/sinking.ll @@ -293,8 +293,8 @@ ; turned into an "implicit location" using DW_OP_stack_value. ; ; DEBUGIFY-LABEL: @test11( -; DEBUGIFY: call void @llvm.dbg.value(metadata %Ty* @X2, metadata {{.*}}, metadata !DIExpression()) -; DEBUGIFY: call void @llvm.dbg.value(metadata %Ty* @X2, metadata {{.*}}, metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value)) +; DEBUGIFY: call void @llvm.dbg.value(metadata %Ty* @X2, metadata {{.*}}, metadata !DIExpression() +; DEBUGIFY: call void @llvm.dbg.value(metadata %Ty* @X2, metadata {{.*}}, metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value) } @c = common global [1 x i32] zeroinitializer, align 4 Index: llvm/test/Transforms/LoopDeletion/diundef.ll =================================================================== --- llvm/test/Transforms/LoopDeletion/diundef.ll +++ llvm/test/Transforms/LoopDeletion/diundef.ll @@ -18,7 +18,7 @@ %exitcond = icmp ne i32 %inc, 3, !dbg !23 br i1 %exitcond, label %for.cond, label %for.end, !dbg !24, !llvm.loop !25 -; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata !16, metadata !DIExpression()), !dbg !17 +; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata !16, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !17 ; CHECK-NEXT: %call = tail call i32 {{.*}} @patatino() for.end: ; preds = %for.cond %call = tail call i32 (...) @patatino() #3, !dbg !27 Index: llvm/test/Transforms/LoopIdiom/memcpy-debugify-remarks.ll =================================================================== --- llvm/test/Transforms/LoopIdiom/memcpy-debugify-remarks.ll +++ llvm/test/Transforms/LoopIdiom/memcpy-debugify-remarks.ll @@ -18,17 +18,17 @@ ; CHECK-NEXT: br label [[FOR_BODY:%.*]], !dbg !18 ; CHECK: for.body: ; CHECK-NEXT: [[INDVAR:%.*]] = phi i64 [ 0, [[BB_NPH:%.*]] ], [ [[INDVAR_NEXT:%.*]], [[FOR_BODY]] ], !dbg !20 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[INDVAR]], metadata !9, metadata !DIExpression()), !dbg !20 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[INDVAR]], metadata !9, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !20 ; CHECK-NEXT: [[I_0_014:%.*]] = getelementptr i32, i32* [[BASE]], i64 [[INDVAR]], !dbg !21 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32* [[I_0_014]], metadata !11, metadata !DIExpression()), !dbg !21 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32* [[I_0_014]], metadata !11, metadata !DIExpression(), metadata i32* undef, metadata !DIExpression()), !dbg !21 ; CHECK-NEXT: [[DESTI:%.*]] = getelementptr i32, i32* [[DEST]], i64 [[INDVAR]], !dbg !22 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32* [[DESTI]], metadata !12, metadata !DIExpression()), !dbg !22 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32* [[DESTI]], metadata !12, metadata !DIExpression(), metadata i32* undef, metadata !DIExpression()), !dbg !22 ; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[I_0_014]], align 1, !dbg !23 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[V]], metadata !13, metadata !DIExpression()), !dbg !23 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[V]], metadata !13, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !23 ; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[INDVAR]], 1, !dbg !24 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[INDVAR_NEXT]], metadata !15, metadata !DIExpression()), !dbg !24 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[INDVAR_NEXT]], metadata !15, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !24 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVAR_NEXT]], [[SIZE]], !dbg !25 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i1 [[EXITCOND]], metadata !16, metadata !DIExpression()), !dbg !25 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i1 [[EXITCOND]], metadata !16, metadata !DIExpression(), metadata i1 undef, metadata !DIExpression()), !dbg !25 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]], !dbg !26 ; CHECK: for.end: ; CHECK-NEXT: ret void, !dbg !27 Index: llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll =================================================================== --- llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll +++ llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll @@ -18,7 +18,7 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[PTR1:%.*]] = ptrtoint i8* [[PTR:%.*]] to i64 ; CHECK-NEXT: [[CMP3:%.*]] = icmp eq i8* [[PTR]], [[END:%.*]], !dbg !15 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i1 [[CMP3]], metadata !9, metadata !DIExpression()), !dbg !15 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i1 [[CMP3]], metadata !9, metadata !DIExpression(), metadata i1 undef, metadata !DIExpression()), !dbg !15 ; CHECK-NEXT: br i1 [[CMP3]], label [[FOR_END:%.*]], label [[FOR_BODY_PREHEADER:%.*]], !dbg !16 ; CHECK: for.body.preheader: ; CHECK-NEXT: [[TMP0:%.*]] = sub i64 0, [[PTR1]], !dbg !17 @@ -28,11 +28,11 @@ ; CHECK-NEXT: br label [[FOR_BODY:%.*]], !dbg !17 ; CHECK: for.body: ; CHECK-NEXT: [[PTR_ADDR_04:%.*]] = phi i8* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[PTR]], [[FOR_BODY_PREHEADER]] ], !dbg !19 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* [[PTR_ADDR_04]], metadata !11, metadata !DIExpression()), !dbg !19 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* [[PTR_ADDR_04]], metadata !11, metadata !DIExpression(), metadata i8* undef, metadata !DIExpression()), !dbg !19 ; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds i8, i8* [[PTR_ADDR_04]], i64 1, !dbg !20 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* [[INCDEC_PTR]], metadata !13, metadata !DIExpression()), !dbg !20 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* [[INCDEC_PTR]], metadata !13, metadata !DIExpression(), metadata i8* undef, metadata !DIExpression()), !dbg !20 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8* [[INCDEC_PTR]], [[END]], !dbg !21 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i1 [[CMP]], metadata !14, metadata !DIExpression()), !dbg !21 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i1 [[CMP]], metadata !14, metadata !DIExpression(), metadata i1 undef, metadata !DIExpression()), !dbg !21 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_END_LOOPEXIT:%.*]], label [[FOR_BODY]], !dbg !17 ; CHECK: for.end.loopexit: ; CHECK-NEXT: br label [[FOR_END]], !dbg !22 Index: llvm/test/Transforms/LoopRotate/dbg-value-duplicates-2.ll =================================================================== --- llvm/test/Transforms/LoopRotate/dbg-value-duplicates-2.ll +++ llvm/test/Transforms/LoopRotate/dbg-value-duplicates-2.ll @@ -4,14 +4,14 @@ define dso_local i16 @main() local_unnamed_addr #0 !dbg !7 { ; CHECK-LABEL: @main( ; CHECK-NEXT: entry: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 9, metadata !12, metadata !DIExpression()), !dbg !13 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 9, metadata !12, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !13 ; CHECK-NEXT: br label [[BB2:%.*]], !dbg !14 ; CHECK: bb2: ; CHECK-NEXT: [[TMP1:%.*]] = phi i16 [ 9, [[ENTRY:%.*]] ], [ [[TMP5:%.*]], [[BB2]] ] -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[TMP1]], metadata !12, metadata !DIExpression()), !dbg !13 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[TMP1]], metadata !12, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !13 ; CHECK-NEXT: [[TMP4:%.*]] = call i16 @wibble(i16 [[TMP1]]), !dbg !14 ; CHECK-NEXT: [[TMP5]] = add nsw i16 [[TMP4]], [[TMP1]], !dbg !14 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[TMP5]], metadata !12, metadata !DIExpression()), !dbg !13 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[TMP5]], metadata !12, metadata !DIExpression(), metadata i16 undef, metadata !DIExpression()), !dbg !13 ; CHECK-NEXT: [[TMP6:%.*]] = call i16 @wibble(i16 [[TMP4]]), !dbg !14 ; CHECK-NEXT: [[TMP7:%.*]] = mul nsw i16 [[TMP6]], 3, !dbg !14 ; CHECK-NEXT: [[TMP8:%.*]] = call i16 @wibble(i16 [[TMP7]]), !dbg !14 Index: llvm/test/Transforms/LoopRotate/dbg-value-duplicates.ll =================================================================== --- llvm/test/Transforms/LoopRotate/dbg-value-duplicates.ll +++ llvm/test/Transforms/LoopRotate/dbg-value-duplicates.ll @@ -11,8 +11,8 @@ call void @llvm.dbg.value(metadata i64 %n, metadata !16, metadata !DIExpression()), !dbg !21 call void @llvm.dbg.value(metadata i64 %s, metadata !17, metadata !DIExpression()), !dbg !22 call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23 - ; CHECK: call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23 - ; CHECK-NOT: call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23 + ; CHECK: call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !23 + ; CHECK-NOT: call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !23 br label %for.cond, !dbg !24 for.cond: ; preds = %for.body, %entry @@ -31,8 +31,8 @@ call void @bar(float %0), !dbg !34 %add = add nsw i64 %i.0, %s, !dbg !35 call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23 - ; CHECK: call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23 - ; CHECK-NOT: call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23 + ; CHECK: call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !23 + ; CHECK-NOT: call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !23 br label %for.cond, !dbg !36, !llvm.loop !37 } Index: llvm/test/Transforms/LoopRotate/dbgvalue.ll =================================================================== --- llvm/test/Transforms/LoopRotate/dbgvalue.ll +++ llvm/test/Transforms/LoopRotate/dbgvalue.ll @@ -8,7 +8,7 @@ ; CHECK-LABEL: define i32 @tak( ; CHECK: entry ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %x -; CHECK: tail call void @llvm.dbg.value(metadata i32 %call +; CHECK: call void @llvm.dbg.value(metadata i32 %call entry: br label %tailrecurse @@ -42,8 +42,8 @@ define i32 @tak2(i32 %x, i32 %y, i32 %z) nounwind ssp !dbg !21 { ; CHECK-LABEL: define i32 @tak2( ; CHECK: entry -; CHECK: tail call void @llvm.dbg.value(metadata i32 %x.tr -; CHECK: tail call void @llvm.dbg.value(metadata i32 undef +; CHECK: call void @llvm.dbg.value(metadata i32 %x.tr +; CHECK: call void @llvm.dbg.value(metadata i32 undef entry: br label %tailrecurse @@ -85,7 +85,7 @@ ; body, even though it contains a debug intrinsic call. ; CHECK-LABEL: define void @FindFreeHorzSeg( ; CHECK: %dec = add -; CHECK-NEXT: tail call void @llvm.dbg.value +; CHECK-NEXT: call void @llvm.dbg.value ; CHECK: %cmp = icmp ; CHECK: br i1 %cmp ; CHECK: phi i64 [ %{{[^,]*}}, %{{[^,]*}} ] Index: llvm/test/Transforms/LoopRotate/phi-dbgvalue.ll =================================================================== --- llvm/test/Transforms/LoopRotate/phi-dbgvalue.ll +++ llvm/test/Transforms/LoopRotate/phi-dbgvalue.ll @@ -3,11 +3,11 @@ ;CHECK-LABEL: func ;CHECK-LABEL: entry -;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 %a -;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 1, metadata ![[I_VAR:[0-9]+]], metadata !DIExpression()) +;CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %a +;CHECK-NEXT: call void @llvm.dbg.value(metadata i32 1, metadata ![[I_VAR:[0-9]+]], metadata !DIExpression() ;CHECK-LABEL: for.body: ;CHECK-NEXT: [[I:%.*]] = phi i32 [ 1, %entry ], [ %inc, %for.body ] -;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 [[I]], metadata ![[I_VAR]], metadata !DIExpression()) +;CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[I]], metadata ![[I_VAR]], metadata !DIExpression() ; CHECK: ![[I_VAR]] = !DILocalVariable(name: "i",{{.*}}) Index: llvm/test/Transforms/LoopUnroll/debug-info.ll =================================================================== --- llvm/test/Transforms/LoopUnroll/debug-info.ll +++ llvm/test/Transforms/LoopUnroll/debug-info.ll @@ -23,10 +23,10 @@ %shr = ashr i32 %i.04, 1, !dbg !18 ; The loop gets unrolled entirely. - ; CHECK: call void @llvm.dbg.value(metadata i32 1, metadata !12, metadata !DIExpression()), !dbg !15 - ; CHECK: call void @llvm.dbg.value(metadata i32 4, metadata !12, metadata !DIExpression()), !dbg !15 - ; CHECK: call void @llvm.dbg.value(metadata i32 16, metadata !12, metadata !DIExpression()), !dbg !15 - ; CHECK: call void @llvm.dbg.value(metadata i32 64, metadata !12, metadata !DIExpression()), !dbg !15 + ; CHECK: call void @llvm.dbg.value(metadata i32 1, metadata !12, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !15 + ; CHECK: call void @llvm.dbg.value(metadata i32 4, metadata !12, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !15 + ; CHECK: call void @llvm.dbg.value(metadata i32 16, metadata !12, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !15 + ; CHECK: call void @llvm.dbg.value(metadata i32 64, metadata !12, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !15 %call = tail call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 %shr) #3, !dbg !20 %shl = shl i32 %i.04, 2, !dbg !21 Index: llvm/test/Transforms/Mem2Reg/dbg-addr-inline-dse.ll =================================================================== --- llvm/test/Transforms/Mem2Reg/dbg-addr-inline-dse.ll +++ llvm/test/Transforms/Mem2Reg/dbg-addr-inline-dse.ll @@ -49,14 +49,14 @@ } ; CHECK-LABEL: define void @f(i32 %x) -; CHECK: call void @llvm.dbg.value(metadata i32 %x, metadata !13, metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 %x, metadata !13, metadata !DIExpression() ; CHECK: %inc.1 = add nsw i32 %x, 1 -; CHECK: call void @llvm.dbg.value(metadata i32 %inc.1, metadata !13, metadata !DIExpression()) -; CHECK: call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 %inc.1, metadata !13, metadata !DIExpression() +; CHECK: call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !DIExpression() ; CHECK: store i32 1, i32* @global, align 4 -; CHECK: call void @llvm.dbg.value(metadata i32 2, metadata !13, metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 2, metadata !13, metadata !DIExpression() ; CHECK: %inc.2 = add nsw i32 2, 1 -; CHECK: call void @llvm.dbg.value(metadata i32 %inc.2, metadata !13, metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 %inc.2, metadata !13, metadata !DIExpression() ; CHECK: ret void attributes #0 = { nounwind uwtable } Index: llvm/test/Transforms/Mem2Reg/dbg-addr.ll =================================================================== --- llvm/test/Transforms/Mem2Reg/dbg-addr.ll +++ llvm/test/Transforms/Mem2Reg/dbg-addr.ll @@ -30,14 +30,14 @@ ; CHECK-LABEL: define i32 @if_else({{.*}}) ; CHECK: entry: ; CHECK-NOT: alloca i32 -; CHECK: call void @llvm.dbg.value(metadata i32 %a, metadata ![[X_LOCAL:[0-9]+]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 %a, metadata ![[X_LOCAL:[0-9]+]], metadata !DIExpression() ; CHECK: if.then: ; preds = %entry -; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[X_LOCAL]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[X_LOCAL]], metadata !DIExpression() ; CHECK: if.else: ; preds = %entry -; CHECK: call void @llvm.dbg.value(metadata i32 %b, metadata ![[X_LOCAL]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 %b, metadata ![[X_LOCAL]], metadata !DIExpression() ; CHECK: if.end: ; preds = %if.else, %if.then ; CHECK: %[[PHI:[^ ]*]] = phi i32 [ 0, %if.then ], [ %b, %if.else ] -; CHECK: call void @llvm.dbg.value(metadata i32 %[[PHI]], metadata ![[X_LOCAL]], metadata !DIExpression()) +; CHECK: call void @llvm.dbg.value(metadata i32 %[[PHI]], metadata ![[X_LOCAL]], metadata !DIExpression() ; CHECK: ret i32 ; CHECK: ![[X_LOCAL]] = !DILocalVariable(name: "x", {{.*}}) Index: llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll =================================================================== --- llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll +++ llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll @@ -96,8 +96,8 @@ ; OPTIMIZATION_LEVEL_2: define i32 @maxB(i32 %x, i32 %y) ; OPTIMIZATION_LEVEL_2-NEXT: entry: -; OPTIMIZATION_LEVEL_2-NEXT: call void @llvm.dbg.value(metadata i32 %x, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_2-NEXT: call void @llvm.dbg.value(metadata i32 %y, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}} +; OPTIMIZATION_LEVEL_2-NEXT: call void @llvm.dbg.value(metadata i32 %x, metadata !{{[0-9]+}}, metadata !DIExpression(), {{.*}}), !dbg !{{[0-9]+}} +; OPTIMIZATION_LEVEL_2-NEXT: call void @llvm.dbg.value(metadata i32 %y, metadata !{{[0-9]+}}, metadata !DIExpression(), {{.*}}), !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_2-NEXT: %0 = tail call i32 @maxA(i32 %x, i32 %y) #{{[0-9]+}}, !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_2-NEXT: ret i32 %0, !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_2-NEXT: } Index: llvm/test/Transforms/Reassociate/matching-binops.ll =================================================================== --- llvm/test/Transforms/Reassociate/matching-binops.ll +++ llvm/test/Transforms/Reassociate/matching-binops.ll @@ -288,18 +288,18 @@ define i32 @and_shl_dbg(i32 %x, i32 %y, i32 %z, i32 %shamt) { ; CHECK-LABEL: @and_shl_dbg( -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[X:%.*]], metadata !7, metadata !DIExpression()), !dbg !20 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[Y:%.*]], metadata !13, metadata !DIExpression()), !dbg !21 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[Z:%.*]], metadata !14, metadata !DIExpression()), !dbg !22 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[SHAMT:%.*]], metadata !15, metadata !DIExpression()), !dbg !23 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[X:%.*]], metadata !7, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !20 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[Y:%.*]], metadata !13, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !21 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[Z:%.*]], metadata !14, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !22 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[SHAMT:%.*]], metadata !15, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !23 ; CHECK-NEXT: [[SHL:%.*]] = shl i32 [[X]], [[SHAMT]], !dbg !24 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[SHL]], metadata !16, metadata !DIExpression()), !dbg !25 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[SHL]], metadata !16, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !25 ; CHECK-NEXT: [[SHL1:%.*]] = shl i32 [[Y]], [[SHAMT]], !dbg !26 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[SHL1]], metadata !17, metadata !DIExpression()), !dbg !27 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[SHL1]], metadata !17, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !27 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[SHL]], [[Z]], !dbg !28 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[AND]], metadata !18, metadata !DIExpression()), !dbg !29 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[AND]], metadata !18, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !29 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[AND]], [[SHL1]], !dbg !30 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[AND2]], metadata !19, metadata !DIExpression()), !dbg !31 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[AND2]], metadata !19, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !31 ; CHECK-NEXT: ret i32 [[AND2]], !dbg !32 ; call void @llvm.dbg.value(metadata i32 %x, metadata !13, metadata !DIExpression()), !dbg !21 Index: llvm/test/Transforms/Reassociate/reassociate_dbgvalue_discard.ll =================================================================== --- llvm/test/Transforms/Reassociate/reassociate_dbgvalue_discard.ll +++ llvm/test/Transforms/Reassociate/reassociate_dbgvalue_discard.ll @@ -11,14 +11,14 @@ define dso_local i32 @test1(i32 %a, i32 %b, i32 %c, i32 %d) local_unnamed_addr #0 !dbg !7 { ; CHECK-LABEL: @test1( ; CHECK-NEXT: entry: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 undef, metadata !16, metadata !DIExpression()), !dbg !20 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression()), !dbg !21 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 undef, metadata !16, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !20 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !21 ; CHECK-NEXT: [[M1:%.*]] = mul i32 [[D:%.*]], [[C:%.*]], !dbg !22 ; CHECK-NEXT: [[M3:%.*]] = mul i32 [[M1]], [[A:%.*]], !dbg !23 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[M3]], metadata !18, metadata !DIExpression()), !dbg !24 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[M3]], metadata !18, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !24 ; CHECK-NEXT: [[M2:%.*]] = mul i32 [[D]], [[C]], !dbg !25 ; CHECK-NEXT: [[M4:%.*]] = mul i32 [[M2]], [[B:%.*]], !dbg !26 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[M4]], metadata !19, metadata !DIExpression()), !dbg !27 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[M4]], metadata !19, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !27 ; CHECK-NEXT: [[RES:%.*]] = xor i32 [[M3]], [[M4]] ; CHECK-NEXT: ret i32 [[RES]], !dbg !28 ; Index: llvm/test/Transforms/Reassociate/reassociate_salvages_debug_info.ll =================================================================== --- llvm/test/Transforms/Reassociate/reassociate_salvages_debug_info.ll +++ llvm/test/Transforms/Reassociate/reassociate_salvages_debug_info.ll @@ -4,7 +4,7 @@ define hidden i32 @main(i32 %argc, i8** %argv) { entry: - ; CHECK: call void @llvm.dbg.value(metadata i32 %argc, metadata [[VAR_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)) + ; CHECK: call void @llvm.dbg.value(metadata i32 %argc, metadata [[VAR_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value) %add = add nsw i32 %argc, 1, !dbg !26 call void @llvm.dbg.value(metadata i32 %add, metadata !22, metadata !DIExpression()), !dbg !25 %add1 = add nsw i32 %argc, %add, !dbg !27 Index: llvm/test/Transforms/Reassociate/undef_intrinsics_when_deleting_instructions.ll =================================================================== --- llvm/test/Transforms/Reassociate/undef_intrinsics_when_deleting_instructions.ll +++ llvm/test/Transforms/Reassociate/undef_intrinsics_when_deleting_instructions.ll @@ -14,7 +14,7 @@ %foo.0.foo.0.16 = load volatile i32, i32* %foo, align 4, !dbg !28, !tbaa !21 ; CHECK-NOT: %add = add nsw i32 %foo.0.foo.0., %foo.0.foo.0.15 %add = add nsw i32 %foo.0.foo.0., %foo.0.foo.0.15, !dbg !29 - ; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata [[VAR_A:![0-9]+]], metadata !DIExpression()) + ; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata [[VAR_A:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !28 call void @llvm.dbg.value(metadata i32 %add, metadata !19, metadata !DIExpression()), !dbg !26 %foo.0.foo.0.17 = load volatile i32, i32* %foo, align 4, !dbg !30, !tbaa !21 %cmp = icmp eq i32 %foo.0.foo.0.17, 4, !dbg !30 @@ -24,9 +24,9 @@ if.then: ; CHECK-NOT: %add1 = add nsw i32 %add, %foo.0.foo.0.16 %add1 = add nsw i32 %add, %foo.0.foo.0.16, !dbg !33 - ; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata [[VAR_A]], metadata !DIExpression()) + ; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata [[VAR_A]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !28 call void @llvm.dbg.value(metadata i32 %add1, metadata !19, metadata !DIExpression()), !dbg !26 - ; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata [[VAR_CHEESE:![0-9]+]], metadata !DIExpression()) + ; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata [[VAR_CHEESE:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !28 call void @llvm.dbg.value(metadata i32 %add, metadata !18, metadata !DIExpression()), !dbg !26 %sub = add nsw i32 %add, -12, !dbg !34 %sub3 = sub nsw i32 %add1, %sub, !dbg !34 Index: llvm/test/Transforms/SLPVectorizer/AArch64/spillcost-di.ll =================================================================== --- llvm/test/Transforms/SLPVectorizer/AArch64/spillcost-di.ll +++ llvm/test/Transforms/SLPVectorizer/AArch64/spillcost-di.ll @@ -9,15 +9,15 @@ define void @patatino(i64 %n, i64 %i, %struct.S* %p) !dbg !7 { ; CHECK-LABEL: @patatino( ; CHECK-NEXT: entry: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[N:%.*]], metadata !18, metadata !DIExpression()), !dbg !23 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[I:%.*]], metadata !19, metadata !DIExpression()), !dbg !24 -; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.S* [[P:%.*]], metadata !20, metadata !DIExpression()), !dbg !25 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[N:%.*]], metadata !18, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !23 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[I:%.*]], metadata !19, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !24 +; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.S* [[P:%.*]], metadata !20, metadata !DIExpression(), metadata %struct.S* undef, metadata !DIExpression()), !dbg !25 ; CHECK-NEXT: [[X1:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], %struct.S* [[P]], i64 [[N]], i32 0, !dbg !26 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 undef, metadata !21, metadata !DIExpression()), !dbg !27 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 undef, metadata !21, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !27 ; CHECK-NEXT: [[Y3:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[P]], i64 [[N]], i32 1, !dbg !28 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i64* [[X1]] to <2 x i64>*, !dbg !26 ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, <2 x i64>* [[TMP0]], align 8, !dbg !26, !tbaa !29 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 undef, metadata !22, metadata !DIExpression()), !dbg !33 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 undef, metadata !22, metadata !DIExpression(), metadata i64 undef, metadata !DIExpression()), !dbg !33 ; CHECK-NEXT: [[X5:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[P]], i64 [[I]], i32 0, !dbg !34 ; CHECK-NEXT: [[Y7:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[P]], i64 [[I]], i32 1, !dbg !35 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64* [[X5]] to <2 x i64>*, !dbg !36 Index: llvm/test/Transforms/SLPVectorizer/X86/debug_info.ll =================================================================== --- llvm/test/Transforms/SLPVectorizer/X86/debug_info.ll +++ llvm/test/Transforms/SLPVectorizer/X86/debug_info.ll @@ -16,11 +16,11 @@ define i32 @depth(double* nocapture %A, i32 %m) #0 !dbg !4 { ; CHECK-LABEL: @depth( ; CHECK-NEXT: entry: -; CHECK-NEXT: call void @llvm.dbg.value(metadata double* [[A:%.*]], metadata !12, metadata !DIExpression()), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[M:%.*]], metadata !13, metadata !DIExpression()), !dbg !18 -; CHECK-NEXT: call void @llvm.dbg.value(metadata double 0.000000e+00, metadata !14, metadata !DIExpression()), !dbg !19 -; CHECK-NEXT: call void @llvm.dbg.value(metadata double 2.000000e-01, metadata !15, metadata !DIExpression()), !dbg !19 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !DIExpression()), !dbg !20 +; CHECK-NEXT: call void @llvm.dbg.value(metadata double* [[A:%.*]], metadata !12, metadata !DIExpression(), metadata double* undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[M:%.*]], metadata !13, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !18 +; CHECK-NEXT: call void @llvm.dbg.value(metadata double 0.000000e+00, metadata !14, metadata !DIExpression(), metadata double undef, metadata !DIExpression()), !dbg !19 +; CHECK-NEXT: call void @llvm.dbg.value(metadata double 2.000000e-01, metadata !15, metadata !DIExpression(), metadata double undef, metadata !DIExpression()), !dbg !19 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !20 ; CHECK-NEXT: [[CMP8:%.*]] = icmp sgt i32 [[M]], 0, !dbg !20 ; CHECK-NEXT: br i1 [[CMP8]], label [[FOR_BODY_LR_PH:%.*]], label [[FOR_END:%.*]], !dbg !20 ; CHECK: for.body.lr.ph: Index: llvm/test/Transforms/SROA/dbg-addr-diamond.ll =================================================================== --- llvm/test/Transforms/SROA/dbg-addr-diamond.ll +++ llvm/test/Transforms/SROA/dbg-addr-diamond.ll @@ -45,19 +45,19 @@ ; CHECK-LABEL: define void @if_else(i32 %cond, i32 %a, i32 %b) ; CHECK: entry: -; CHECK: call void @llvm.dbg.value(metadata i32 %a, metadata ![[PVAR:[0-9]+]], metadata ![[XFRAG:DIExpression\(DW_OP_LLVM_fragment, 0, 32\)]]) -; CHECK: call void @llvm.dbg.value(metadata i32 %b, metadata ![[PVAR]], metadata ![[YFRAG:DIExpression\(DW_OP_LLVM_fragment, 32, 32\)]]) +; CHECK: call void @llvm.dbg.value(metadata i32 %a, metadata ![[PVAR:[0-9]+]], metadata ![[XFRAG:DIExpression\(DW_OP_LLVM_fragment, 0, 32\)]] +; CHECK: call void @llvm.dbg.value(metadata i32 %b, metadata ![[PVAR]], metadata ![[YFRAG:DIExpression\(DW_OP_LLVM_fragment, 32, 32\)]] ; CHECK: if.then: -; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[PVAR]], metadata ![[XFRAG]]) -; CHECK: call void @llvm.dbg.value(metadata i32 %a, metadata ![[PVAR]], metadata ![[YFRAG]]) +; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[PVAR]], metadata ![[XFRAG]] +; CHECK: call void @llvm.dbg.value(metadata i32 %a, metadata ![[PVAR]], metadata ![[YFRAG]] ; CHECK: if.else: -; CHECK: call void @llvm.dbg.value(metadata i32 %b, metadata ![[PVAR]], metadata ![[XFRAG]]) -; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[PVAR]], metadata ![[YFRAG]]) +; CHECK: call void @llvm.dbg.value(metadata i32 %b, metadata ![[PVAR]], metadata ![[XFRAG]] +; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[PVAR]], metadata ![[YFRAG]] ; CHECK: if.end: ; CHECK: %p.sroa.4.0 = phi i32 [ %a, %if.then ], [ 0, %if.else ] ; CHECK: %p.sroa.0.0 = phi i32 [ 0, %if.then ], [ %b, %if.else ] -; CHECK: call void @llvm.dbg.value(metadata i32 %p.sroa.0.0, metadata ![[PVAR]], metadata ![[XFRAG]]) -; CHECK: call void @llvm.dbg.value(metadata i32 %p.sroa.4.0, metadata ![[PVAR]], metadata ![[YFRAG]]) +; CHECK: call void @llvm.dbg.value(metadata i32 %p.sroa.0.0, metadata ![[PVAR]], metadata ![[XFRAG]] +; CHECK: call void @llvm.dbg.value(metadata i32 %p.sroa.4.0, metadata ![[PVAR]], metadata ![[YFRAG]] ; CHECK: ![[PVAR]] = !DILocalVariable(name: "p", {{.*}}) Index: llvm/test/Transforms/SROA/dbg-inline.ll =================================================================== --- llvm/test/Transforms/SROA/dbg-inline.ll +++ llvm/test/Transforms/SROA/dbg-inline.ll @@ -16,10 +16,10 @@ store i64 %p.coerce0, i64* %0, align 8 %1 = getelementptr inbounds %struct.pair, %struct.pair* %p, i32 0, i32 1 store i64 %p.coerce1, i64* %1, align 8 - ; CHECK-DAG: call void @llvm.dbg.value(metadata i64 %p.coerce0, metadata ![[VAR:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg ![[LOC:[0-9]+]] - ; CHECK-DAG: call void @llvm.dbg.value(metadata i64 %p.coerce1, metadata ![[VAR]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg ![[LOC]] - ; CHECK-DAG: call void @llvm.dbg.value(metadata i64 %p.coerce0, metadata ![[INLINED_VAR:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg ![[INLINED_LOC:[0-9]+]] - ; CHECK-DAG: call void @llvm.dbg.value(metadata i64 %p.coerce1, metadata ![[INLINED_VAR]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg ![[INLINED_LOC]] + ; CHECK-DAG: call void @llvm.dbg.value(metadata i64 %p.coerce0, metadata ![[VAR:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64), metadata i64 %p.coerce0, metadata !DIExpression()), !dbg ![[LOC:[0-9]+]] + ; CHECK-DAG: call void @llvm.dbg.value(metadata i64 %p.coerce1, metadata ![[VAR]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64), metadata i64 %p.coerce1, metadata !DIExpression()), !dbg ![[LOC]] + ; CHECK-DAG: call void @llvm.dbg.value(metadata i64 %p.coerce0, metadata ![[INLINED_VAR:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64), metadata i64 undef, metadata !DIExpression()), !dbg ![[INLINED_LOC:[0-9]+]] + ; CHECK-DAG: call void @llvm.dbg.value(metadata i64 %p.coerce1, metadata ![[INLINED_VAR]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64), metadata i64 undef, metadata !DIExpression()), !dbg ![[INLINED_LOC]] call void @llvm.dbg.declare(metadata %struct.pair* %p, metadata !17, metadata !DIExpression()), !dbg !18 call void @llvm.dbg.declare(metadata %struct.pair* %p, metadata !21, metadata !DIExpression()), !dbg !23 %a.i = getelementptr inbounds %struct.pair, %struct.pair* %p, i32 0, i32 0, !dbg !25 Index: llvm/test/Transforms/SROA/dbg-single-piece.ll =================================================================== --- llvm/test/Transforms/SROA/dbg-single-piece.ll +++ llvm/test/Transforms/SROA/dbg-single-piece.ll @@ -11,7 +11,7 @@ ; Checks that SROA still inserts a bit_piece expression, even if it produces only one piece ; (as long as that piece is smaller than the whole thing) ; CHECK-NOT: call void @llvm.dbg.value -; CHECK: call void @llvm.dbg.value(metadata %foo* undef, {{.*}}, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg +; CHECK: call void @llvm.dbg.value(metadata %foo* undef, {{.*}}, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64), metadata %foo* undef, {{.*}}), !dbg ; CHECK-NOT: call void @llvm.dbg.value %0 = bitcast %foo* %retval to i8* %1 = getelementptr inbounds i8, i8* %0, i64 8 Index: llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll =================================================================== --- llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll +++ llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll @@ -14,7 +14,7 @@ %0 = zext i32 %n to i64, !dbg !16 ; CHECK: store i8* %[[VLA:.*]], i8** @__safestack_unsafe_stack_ptr -; CHECK: tail call void @llvm.dbg.value(metadata i8* %[[VLA]], metadata ![[TYPE:.*]], metadata !DIExpression(DW_OP_deref)) +; CHECK: call void @llvm.dbg.value(metadata i8* %[[VLA]], metadata ![[TYPE:.*]], metadata !DIExpression(DW_OP_deref) ; CHECK: call void @capture({{.*}} %[[VLA]]) %vla = alloca i8, i64 %0, align 16, !dbg !16 Index: llvm/test/Transforms/SafeStack/X86/debug-loc2.ll =================================================================== --- llvm/test/Transforms/SafeStack/X86/debug-loc2.ll +++ llvm/test/Transforms/SafeStack/X86/debug-loc2.ll @@ -17,19 +17,19 @@ %1 = bitcast i32* %x2 to i8*, !dbg !14 ; Unhandled dbg.value: expression does not start with OP_DW_deref -; CHECK: call void @llvm.dbg.value(metadata i32* undef, metadata !{{.*}}, metadata !{{.*}}) +; CHECK: call void @llvm.dbg.value(metadata i32* undef, metadata !{{.*}}, metadata !{{.*}} tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !23), !dbg !16 ; Unhandled dbg.value: expression does not start with OP_DW_deref -; CHECK: call void @llvm.dbg.value(metadata i32* undef, metadata !{{.*}}, metadata !{{.*}}) +; CHECK: call void @llvm.dbg.value(metadata i32* undef, metadata !{{.*}}, metadata !{{.*}} tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !24), !dbg !16 ; Supported dbg.value: rewritted based on the [[USP]] value. -; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_constu, 4, DW_OP_minus, DW_OP_deref, DW_OP_LLVM_fragment, 0, 4)) +; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_constu, 4, DW_OP_minus, DW_OP_deref, DW_OP_LLVM_fragment, 0, 4) tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !25), !dbg !16 ; Supported dbg.value: rewritted based on the [[USP]] value. -; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_constu, 4, DW_OP_minus, DW_OP_deref)) +; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_constu, 4, DW_OP_minus, DW_OP_deref) tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !15), !dbg !16 call void @capture(i32* nonnull %x1), !dbg !17 @@ -37,7 +37,7 @@ ; CHECK: call void @llvm.random.metadata.use(metadata i32* undef call void @llvm.random.metadata.use(metadata i32* %x2) -; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X2:.*]], metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref)) +; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X2:.*]], metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref) call void @llvm.dbg.value(metadata i32* %x2, metadata !12, metadata !15), !dbg !18 call void @capture(i32* nonnull %x2), !dbg !19 ret void, !dbg !20 Index: llvm/test/Transforms/Scalarizer/dbginfo.ll =================================================================== --- llvm/test/Transforms/Scalarizer/dbginfo.ll +++ llvm/test/Transforms/Scalarizer/dbginfo.ll @@ -17,9 +17,9 @@ ; CHECK: %b.i1 = getelementptr i32, i32* %b.i0, i32 1 ; CHECK: %b.i2 = getelementptr i32, i32* %b.i0, i32 2 ; CHECK: %b.i3 = getelementptr i32, i32* %b.i0, i32 3 -; CHECK: tail call void @llvm.dbg.value(metadata <4 x i32>* %a, metadata !{{[0-9]+}}, metadata {{.*}}), !dbg !{{[0-9]+}} -; CHECK: tail call void @llvm.dbg.value(metadata <4 x i32>* %b, metadata !{{[0-9]+}}, metadata {{.*}}), !dbg !{{[0-9]+}} -; CHECK: tail call void @llvm.dbg.value(metadata <4 x i32>* %c, metadata !{{[0-9]+}}, metadata {{.*}}), !dbg !{{[0-9]+}} +; CHECK: call void @llvm.dbg.value(metadata <4 x i32>* %a, metadata !{{[0-9]+}}, metadata {{.*}}, metadata <4 x i32>* undef, {{.*}}), !dbg !{{[0-9]+}} +; CHECK: call void @llvm.dbg.value(metadata <4 x i32>* %b, metadata !{{[0-9]+}}, metadata {{.*}}, metadata <4 x i32>* undef, {{.*}}), !dbg !{{[0-9]+}} +; CHECK: call void @llvm.dbg.value(metadata <4 x i32>* %c, metadata !{{[0-9]+}}, metadata {{.*}}, metadata <4 x i32>* undef, {{.*}}), !dbg !{{[0-9]+}} ; CHECK: %bval.i0 = load i32, i32* %b.i0, align 16, !dbg ![[TAG1:[0-9]+]], !tbaa ![[TAG2:[0-9]+]] ; CHECK: %bval.i1 = load i32, i32* %b.i1, align 4, !dbg ![[TAG1]], !tbaa ![[TAG2]] ; CHECK: %bval.i2 = load i32, i32* %b.i2, align 8, !dbg ![[TAG1]], !tbaa ![[TAG2]] Index: llvm/test/Transforms/SimplifyCFG/X86/pr39187-g.ll =================================================================== --- llvm/test/Transforms/SimplifyCFG/X86/pr39187-g.ll +++ llvm/test/Transforms/SimplifyCFG/X86/pr39187-g.ll @@ -38,8 +38,8 @@ ; CHECK: %foo.0. = load volatile i32, i32* %foo, align 4, !dbg !16 ; CHECK: %cmp = icmp eq i32 %foo.0., 4, !dbg !16 ; CHECK: %frombool = zext i1 %cmp to i8, !dbg !16 -; CHECK: call void @llvm.dbg.value(metadata i8 %frombool, metadata !13, metadata !DIExpression()), !dbg !16 -; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !DIExpression()), !dbg !17 +; CHECK: call void @llvm.dbg.value(metadata i8 %frombool, metadata !13, metadata !DIExpression(), metadata i8 undef, metadata !DIExpression()), !dbg !16 +; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !17 ; CHECK: %. = select i1 %cmp, i32 8, i32 4, !dbg ![[MERGEDLOC:[0-9]+]] ; CHECK: ![[MERGEDLOC]] = !DILocation(line: 0, scope: !7) Index: llvm/test/Transforms/SimplifyCFG/speculate-dbgvalue.ll =================================================================== --- llvm/test/Transforms/SimplifyCFG/speculate-dbgvalue.ll +++ llvm/test/Transforms/SimplifyCFG/speculate-dbgvalue.ll @@ -18,14 +18,14 @@ define i32 @test1(i32 %getdirt, i32 %dirt) #0 !dbg !7 { ; CHECK-LABEL: @test1( ; CHECK-NEXT: entry: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[GETDIRT:%.*]], metadata !12, metadata !DIExpression()), !dbg !15 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[DIRT:%.*]], metadata !13, metadata !DIExpression()), !dbg !16 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 100, metadata !14, metadata !DIExpression()), !dbg !17 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[GETDIRT:%.*]], metadata !12, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !15 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[DIRT:%.*]], metadata !13, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !16 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 100, metadata !14, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !17 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[GETDIRT]], 0, !dbg !18 ; *** We used to get an incorrect "call void @llvm.dbg.value(metadata i32 [[DIRT]], metadata !14, metadata !DIExpression()), !dbg !17" here, before the select. *** ; CHECK-NOT: call void @llvm.dbg.value(metadata i32 [[DIRT]], metadata !14 ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[CMP]], i32 [[DIRT]], i32 100, !dbg !20 -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[RESULT]], metadata !14, metadata !DIExpression()), !dbg !17 +; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[RESULT]], metadata !14, metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg !17 ; CHECK-NEXT: ret i32 [[RESULT]], !dbg !21 ; CHECK: !12 = !DILocalVariable(name: "getdirt" ; CHECK: !13 = !DILocalVariable(name: "dirt" Index: llvm/test/Transforms/Util/Debugify/loc-only.ll =================================================================== --- llvm/test/Transforms/Util/Debugify/loc-only.ll +++ llvm/test/Transforms/Util/Debugify/loc-only.ll @@ -5,10 +5,10 @@ define void @test() { %add = add i32 1, 2 ; ALL-NEXT: %add = add i32 1, 2, !dbg [[L1:![0-9]+]] -; VALUE-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata [[add:![0-9]+]], metadata !DIExpression()), !dbg [[L1]] +; VALUE-NEXT: call void @llvm.dbg.value(metadata i32 %add, metadata [[add:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg [[L1]] %sub = sub i32 %add, 1 ; ALL-NEXT: %sub = sub i32 %add, 1, !dbg [[L2:![0-9]+]] -; VALUE-NEXT: call void @llvm.dbg.value(metadata i32 %sub, metadata [[sub:![0-9]+]], metadata !DIExpression()), !dbg [[L2]] +; VALUE-NEXT: call void @llvm.dbg.value(metadata i32 %sub, metadata [[sub:![0-9]+]], metadata !DIExpression(), metadata i32 undef, metadata !DIExpression()), !dbg [[L2]] ; ALL-NEXT: ret void, !dbg [[L3:![0-9]+]] ret void } Index: llvm/test/Transforms/Util/dbg-user-of-aext.ll =================================================================== --- llvm/test/Transforms/Util/dbg-user-of-aext.ll +++ llvm/test/Transforms/Util/dbg-user-of-aext.ll @@ -19,10 +19,10 @@ ; parameter. It can reference the register it's in directly without masking off ; high bits or anything -; CHECK: call void @llvm.dbg.value(metadata i8 %g.coerce0, metadata ![[VAR_STRUCT:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8)) -; CHECK: call void @llvm.dbg.value(metadata i64 %g.coerce1, metadata ![[VAR_STRUCT]], metadata !DIExpression(DW_OP_LLVM_fragment, 32, 64)) -; CHECK: call void @llvm.dbg.value(metadata i8 %frombool, metadata ![[VAR_BOOL:[0-9]+]], metadata !DIExpression()) -; CHECK: call void @llvm.dbg.value(metadata i8 %frombool1, metadata ![[VAR_FRAG:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 4)) +; CHECK: call void @llvm.dbg.value(metadata i8 %g.coerce0, metadata ![[VAR_STRUCT:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8) +; CHECK: call void @llvm.dbg.value(metadata i64 %g.coerce1, metadata ![[VAR_STRUCT]], metadata !DIExpression(DW_OP_LLVM_fragment, 32, 64) +; CHECK: call void @llvm.dbg.value(metadata i8 %frombool, metadata ![[VAR_BOOL:[0-9]+]], metadata !DIExpression() +; CHECK: call void @llvm.dbg.value(metadata i8 %frombool1, metadata ![[VAR_FRAG:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 4) %struct.foo = type { i8, i64 } Index: llvm/test/Verifier/diexpression-entry-value-llvm-ir.ll =================================================================== --- llvm/test/Verifier/diexpression-entry-value-llvm-ir.ll +++ llvm/test/Verifier/diexpression-entry-value-llvm-ir.ll @@ -3,7 +3,7 @@ ; The DW_OP_LLVM_entry_value operation can only be used in MIR. ; CHECK: Entry values are only allowed in MIR -; CHECK: call void @llvm.dbg.value(metadata i32 %param, metadata !{{.*}}, metadata !DIExpression(DW_OP_LLVM_entry_value, 1)) +; CHECK: call void @llvm.dbg.value(metadata i32 %param, metadata !{{.*}}, metadata !DIExpression(DW_OP_LLVM_entry_value, 1) ; CHECK: warning: ignoring invalid debug info define void @foo(i32 %param) !dbg !4 { Index: llvm/test/Verifier/diexpression-valid-entry-value.ll =================================================================== --- llvm/test/Verifier/diexpression-valid-entry-value.ll +++ llvm/test/Verifier/diexpression-valid-entry-value.ll @@ -1,5 +1,7 @@ ; RUN: opt -S < %s 2>&1 | FileCheck %s -!named = !{!0} +!named = !{!0, !1, !2} ; CHECK-NOT: invalid expression !0 = !DIExpression(DW_OP_LLVM_entry_value, 1) +!1 = !DIExpression(DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 3, DW_OP_stack_value) +!2 = !DIExpression(DW_OP_LLVM_entry_value, 1, DW_OP_constu, 9, DW_OP_minus, DW_OP_stack_value) Index: llvm/test/Verifier/llvm.dbg.intrinsic-dbg-attachment.ll =================================================================== --- llvm/test/Verifier/llvm.dbg.intrinsic-dbg-attachment.ll +++ llvm/test/Verifier/llvm.dbg.intrinsic-dbg-attachment.ll @@ -25,7 +25,7 @@ metadata !DIExpression()), !dbg !DILocation(scope: !2) ; CHECK-LABEL: mismatched subprogram between llvm.dbg.value variable and !dbg attachment -; CHECK-NEXT: call void @llvm.dbg.value({{[^,]+}}, metadata ![[VAR:[0-9]+]], {{[^,]+}}), !dbg ![[LOC:[0-9]+]] +; CHECK-NEXT: call void @llvm.dbg.value({{[^,]+}}, metadata ![[VAR:[0-9]+]], {{[^,]+}}, {{.*}}), !dbg ![[LOC:[0-9]+]] ; CHECK-NEXT: label %entry ; CHECK-NEXT: void ()* @foo ; CHECK-NEXT: ![[VAR]] = !DILocalVariable({{.*}}scope: ![[VARSP:[0-9]+]] Index: llvm/unittests/IR/BasicBlockTest.cpp =================================================================== --- llvm/unittests/IR/BasicBlockTest.cpp +++ llvm/unittests/IR/BasicBlockTest.cpp @@ -107,13 +107,14 @@ Function *DbgValue = Intrinsic::getDeclaration(M, Intrinsic::dbg_value); Value *DIV = MetadataAsValue::get(Ctx, (Metadata *)nullptr); SmallVector Args = {DIV, DIV, DIV}; + SmallVector DbgValueArgs = {DIV, DIV, DIV, DIV, DIV}; BasicBlock *BB1 = BasicBlock::Create(Ctx, "", F); const BasicBlock *BBConst = BB1; IRBuilder<> Builder1(BB1); AllocaInst *Var = Builder1.CreateAlloca(Builder1.getInt8Ty()); - Builder1.CreateCall(DbgValue, Args); + Builder1.CreateCall(DbgValue, DbgValueArgs); Instruction *AddInst = cast(Builder1.CreateAdd(V, V)); Instruction *MulInst = cast(Builder1.CreateMul(AddInst, V)); Builder1.CreateCall(DbgDeclare, Args);