DebugInfo: Remove 'inlinedAt:' field from MDLocalVariable

Remove 'inlinedAt:' from MDLocalVariable.  Besides saving some memory
(variables with it seem to be single largest `Metadata` contributer to
memory usage right now in -g -flto builds), this stops optimization and
backend passes from having to change local variables.

The 'inlinedAt:' field was used by the backend in two ways:

 1. To tell the backend whether and into what a variable was inlined.
 2. To create a unique id for each inlined variable.

Instead, rely on the 'inlinedAt:' field of the intrinsic's `!dbg`
attachment, and change the DWARF backend to use a typedef called
`InlinedVariable` which is `std::pair<MDLocalVariable*, MDLocation*>`.
This `DebugLoc` is already passed reliably through the backend (as
verified by r234021).

This commit removes the check from r234021, but I added a new check
(that will survive) in r235048, and changed the `DIBuilder` API in
r235041 to require a `!dbg` attachment whose 'scope:` is in the same
`MDSubprogram` as the variable's.

If this breaks your out-of-tree testcases, perhaps the script I used
(mdlocalvariable-drop-inlinedat.sh) will help; I'll attach it to PR22778
in a moment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235050 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-04-15 22:29:27 +00:00
parent 94255c8eb0
commit 88e419d66e
51 changed files with 208 additions and 289 deletions

View File

@ -3235,21 +3235,15 @@ arguments (``DW_TAG_arg_variable``). In the latter case, the ``arg:`` field
specifies the argument position, and this variable will be included in the
``variables:`` field of its :ref:`MDSubprogram`.
If set, the ``inlinedAt:`` field points at an :ref:`MDLocation`, and the
variable represents an inlined version of a variable (with all other fields
duplicated from the non-inlined version).
.. code-block:: llvm
!0 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 0,
scope: !3, file: !2, line: 7, type: !3,
flags: DIFlagArtificial, inlinedAt: !4)
flags: DIFlagArtificial)
!1 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1,
scope: !4, file: !2, line: 7, type: !3,
inlinedAt: !6)
scope: !4, file: !2, line: 7, type: !3)
!1 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "y",
scope: !5, file: !2, line: 7, type: !3,
inlinedAt: !6)
scope: !5, file: !2, line: 7, type: !3)
MDExpression
""""""""""""

View File

@ -184,12 +184,13 @@ public:
static char ID; // Pass identification, replacement for typeid
struct VariableDbgInfo {
TrackingMDNodeRef Var;
TrackingMDNodeRef Expr;
const MDLocalVariable *Var;
const MDExpression *Expr;
unsigned Slot;
DebugLoc Loc;
const MDLocation *Loc;
VariableDbgInfo(MDNode *Var, MDNode *Expr, unsigned Slot, DebugLoc Loc)
VariableDbgInfo(const MDLocalVariable *Var, const MDExpression *Expr,
unsigned Slot, const MDLocation *Loc)
: Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
};
typedef SmallVector<VariableDbgInfo, 4> VariableDbgInfoMapTy;
@ -437,8 +438,8 @@ public:
/// setVariableDbgInfo - Collect information used to emit debugging
/// information of a variable.
void setVariableDbgInfo(MDNode *Var, MDNode *Expr, unsigned Slot,
DebugLoc Loc) {
void setVariableDbgInfo(const MDLocalVariable *Var, const MDExpression *Expr,
unsigned Slot, const MDLocation *Loc) {
VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
}

View File

@ -622,16 +622,6 @@ DISubprogram getDISubprogram(const Function *F);
/// \brief Find underlying composite type.
DICompositeType getDICompositeType(DIType T);
/// \brief Create a new inlined variable based on current variable.
///
/// @param DV Current Variable.
/// @param InlinedScope Location at current variable is inlined.
DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
LLVMContext &VMContext);
/// \brief Remove inlined scope from the variable.
DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
/// \brief Generate map by visiting all retained types.
DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes);

View File

@ -1877,38 +1877,32 @@ class MDLocalVariable : public MDVariable {
static MDLocalVariable *getImpl(LLVMContext &Context, unsigned Tag,
MDScope *Scope, StringRef Name, MDFile *File,
unsigned Line, MDTypeRef Type, unsigned Arg,
unsigned Flags, MDLocation *InlinedAt,
StorageType Storage,
unsigned Flags, StorageType Storage,
bool ShouldCreate = true) {
return getImpl(Context, Tag, Scope, getCanonicalMDString(Context, Name),
File, Line, Type, Arg, Flags, InlinedAt, Storage,
ShouldCreate);
File, Line, Type, Arg, Flags, Storage, ShouldCreate);
}
static MDLocalVariable *getImpl(LLVMContext &Context, unsigned Tag,
Metadata *Scope, MDString *Name,
Metadata *File, unsigned Line, Metadata *Type,
unsigned Arg, unsigned Flags,
Metadata *InlinedAt, StorageType Storage,
bool ShouldCreate = true);
static MDLocalVariable *
getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name,
Metadata *File, unsigned Line, Metadata *Type, unsigned Arg,
unsigned Flags, StorageType Storage, bool ShouldCreate = true);
TempMDLocalVariable cloneImpl() const {
return getTemporary(getContext(), getTag(), getScope(), getName(),
getFile(), getLine(), getType(), getArg(), getFlags(),
getInlinedAt());
getFile(), getLine(), getType(), getArg(), getFlags());
}
public:
DEFINE_MDNODE_GET(MDLocalVariable,
(unsigned Tag, MDLocalScope *Scope, StringRef Name,
MDFile *File, unsigned Line, MDTypeRef Type, unsigned Arg,
unsigned Flags, MDLocation *InlinedAt = nullptr),
(Tag, Scope, Name, File, Line, Type, Arg, Flags, InlinedAt))
unsigned Flags),
(Tag, Scope, Name, File, Line, Type, Arg, Flags))
DEFINE_MDNODE_GET(MDLocalVariable,
(unsigned Tag, Metadata *Scope, MDString *Name,
Metadata *File, unsigned Line, Metadata *Type,
unsigned Arg, unsigned Flags,
Metadata *InlinedAt = nullptr),
(Tag, Scope, Name, File, Line, Type, Arg, Flags, InlinedAt))
unsigned Arg, unsigned Flags),
(Tag, Scope, Name, File, Line, Type, Arg, Flags))
TempMDLocalVariable clone() const { return cloneImpl(); }
@ -1921,11 +1915,6 @@ public:
unsigned getArg() const { return Arg; }
unsigned getFlags() const { return Flags; }
MDLocation *getInlinedAt() const {
return cast_or_null<MDLocation>(getRawInlinedAt());
}
Metadata *getRawInlinedAt() const { return getOperand(4); }
bool isArtificial() const { return getFlags() & FlagArtificial; }
bool isObjectPointer() const { return getFlags() & FlagObjectPointer; }
@ -1936,22 +1925,9 @@ public:
/// inlined-at location as \c this. (Otherwise, it's not a valid attachemnt
/// to a \a DbgInfoIntrinsic.)
bool isValidLocationForIntrinsic(const MDLocation *DL) const {
return DL && getInlinedAt() == DL->getInlinedAt() &&
getScope()->getSubprogram() == DL->getScope()->getSubprogram();
return DL && getScope()->getSubprogram() == DL->getScope()->getSubprogram();
}
/// \brief Get an inlined version of this variable.
///
/// Returns a version of this with \a getAlinedAt() set to \c InlinedAt.
MDLocalVariable *withInline(MDLocation *InlinedAt) const {
if (InlinedAt == getInlinedAt())
return const_cast<MDLocalVariable *>(this);
auto Temp = clone();
Temp->replaceOperandWith(4, InlinedAt);
return replaceWithUniqued(std::move(Temp));
}
MDLocalVariable *withoutInline() const { return withInline(nullptr); }
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == MDLocalVariableKind;
}

View File

@ -3680,8 +3680,7 @@ bool LLParser::ParseMDGlobalVariable(MDNode *&Result, bool IsDistinct) {
/// ParseMDLocalVariable:
/// ::= !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo",
/// file: !1, line: 7, type: !2, arg: 2, flags: 7,
/// inlinedAt: !3)
/// file: !1, line: 7, type: !2, arg: 2, flags: 7)
bool LLParser::ParseMDLocalVariable(MDNode *&Result, bool IsDistinct) {
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
REQUIRED(tag, DwarfTagField, ); \
@ -3691,14 +3690,13 @@ bool LLParser::ParseMDLocalVariable(MDNode *&Result, bool IsDistinct) {
OPTIONAL(line, LineField, ); \
OPTIONAL(type, MDField, ); \
OPTIONAL(arg, MDUnsignedField, (0, UINT8_MAX)); \
OPTIONAL(flags, DIFlagField, ); \
OPTIONAL(inlinedAt, MDField, );
OPTIONAL(flags, DIFlagField, );
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS
Result = GET_OR_DISTINCT(
MDLocalVariable, (Context, tag.Val, scope.Val, name.Val, file.Val,
line.Val, type.Val, arg.Val, flags.Val, inlinedAt.Val));
Result = GET_OR_DISTINCT(MDLocalVariable,
(Context, tag.Val, scope.Val, name.Val, file.Val,
line.Val, type.Val, arg.Val, flags.Val));
return false;
}

View File

@ -1911,7 +1911,8 @@ std::error_code BitcodeReader::ParseMetadata() {
break;
}
case bitc::METADATA_LOCAL_VAR: {
if (Record.size() != 10)
// 10th field is for the obseleted 'inlinedAt:' field.
if (Record.size() != 9 && Record.size() != 10)
return Error("Invalid record");
MDValueList.AssignValue(
@ -1919,7 +1920,7 @@ std::error_code BitcodeReader::ParseMetadata() {
(Context, Record[1], getMDOrNull(Record[2]),
getMDString(Record[3]), getMDOrNull(Record[4]),
Record[5], getMDOrNull(Record[6]), Record[7],
Record[8], getMDOrNull(Record[9]))),
Record[8])),
NextMDValueNo++);
break;
}

View File

@ -1085,7 +1085,6 @@ static void WriteMDLocalVariable(const MDLocalVariable *N,
Record.push_back(VE.getMetadataOrNullID(N->getType()));
Record.push_back(N->getArg());
Record.push_back(N->getFlags());
Record.push_back(VE.getMetadataOrNullID(N->getInlinedAt()));
Stream.EmitRecord(bitc::METADATA_LOCAL_VAR, Record, Abbrev);
Record.clear();

View File

@ -33,7 +33,7 @@ static unsigned isDescribedByReg(const MachineInstr &MI) {
return MI.getOperand(0).isReg() ? MI.getOperand(0).getReg() : 0;
}
void DbgValueHistoryMap::startInstrRange(const MDNode *Var,
void DbgValueHistoryMap::startInstrRange(InlinedVariable Var,
const MachineInstr &MI) {
// Instruction range should start with a DBG_VALUE instruction for the
// variable.
@ -48,7 +48,7 @@ void DbgValueHistoryMap::startInstrRange(const MDNode *Var,
Ranges.push_back(std::make_pair(&MI, nullptr));
}
void DbgValueHistoryMap::endInstrRange(const MDNode *Var,
void DbgValueHistoryMap::endInstrRange(InlinedVariable Var,
const MachineInstr &MI) {
auto &Ranges = VarInstrRanges[Var];
// Verify that the current instruction range is not yet closed.
@ -59,7 +59,7 @@ void DbgValueHistoryMap::endInstrRange(const MDNode *Var,
Ranges.back().second = &MI;
}
unsigned DbgValueHistoryMap::getRegisterForVar(const MDNode *Var) const {
unsigned DbgValueHistoryMap::getRegisterForVar(InlinedVariable Var) const {
const auto &I = VarInstrRanges.find(Var);
if (I == VarInstrRanges.end())
return 0;
@ -71,12 +71,13 @@ unsigned DbgValueHistoryMap::getRegisterForVar(const MDNode *Var) const {
namespace {
// Maps physreg numbers to the variables they describe.
typedef std::map<unsigned, SmallVector<const MDNode *, 1>> RegDescribedVarsMap;
typedef DbgValueHistoryMap::InlinedVariable InlinedVariable;
typedef std::map<unsigned, SmallVector<InlinedVariable, 1>> RegDescribedVarsMap;
}
// \brief Claim that @Var is not described by @RegNo anymore.
static void dropRegDescribedVar(RegDescribedVarsMap &RegVars,
unsigned RegNo, const MDNode *Var) {
static void dropRegDescribedVar(RegDescribedVarsMap &RegVars, unsigned RegNo,
InlinedVariable Var) {
const auto &I = RegVars.find(RegNo);
assert(RegNo != 0U && I != RegVars.end());
auto &VarSet = I->second;
@ -89,8 +90,8 @@ static void dropRegDescribedVar(RegDescribedVarsMap &RegVars,
}
// \brief Claim that @Var is now described by @RegNo.
static void addRegDescribedVar(RegDescribedVarsMap &RegVars,
unsigned RegNo, const MDNode *Var) {
static void addRegDescribedVar(RegDescribedVarsMap &RegVars, unsigned RegNo,
InlinedVariable Var) {
assert(RegNo != 0U);
auto &VarSet = RegVars[RegNo];
assert(std::find(VarSet.begin(), VarSet.end(), Var) == VarSet.end());
@ -203,9 +204,13 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF,
// Use the base variable (without any DW_OP_piece expressions)
// as index into History. The full variables including the
// piece expressions are attached to the MI.
DIVariable Var = MI.getDebugVariable();
assert(Var->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
MDLocalVariable *RawVar = MI.getDebugVariable();
assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
"Expected inlined-at fields to agree");
MDLocation *IA = nullptr;
if (MDLocation *Loc = MI.getDebugLoc())
IA = Loc->getInlinedAt();
InlinedVariable Var(RawVar, IA);
if (unsigned PrevReg = Result.getRegisterForVar(Var))
dropRegDescribedVar(RegVars, PrevReg, Var);

View File

@ -17,7 +17,8 @@ namespace llvm {
class MachineFunction;
class MachineInstr;
class MDNode;
class MDLocalVariable;
class MDLocation;
class TargetRegisterInfo;
// For each user variable, keep a list of instruction ranges where this variable
@ -31,16 +32,19 @@ class DbgValueHistoryMap {
public:
typedef std::pair<const MachineInstr *, const MachineInstr *> InstrRange;
typedef SmallVector<InstrRange, 4> InstrRanges;
typedef MapVector<const MDNode *, InstrRanges> InstrRangesMap;
typedef std::pair<const MDLocalVariable *, const MDLocation *>
InlinedVariable;
typedef MapVector<InlinedVariable, InstrRanges> InstrRangesMap;
private:
InstrRangesMap VarInstrRanges;
public:
void startInstrRange(const MDNode *Var, const MachineInstr &MI);
void endInstrRange(const MDNode *Var, const MachineInstr &MI);
void startInstrRange(InlinedVariable Var, const MachineInstr &MI);
void endInstrRange(InlinedVariable Var, const MachineInstr &MI);
// Returns register currently describing @Var. If @Var is currently
// unaccessible or is not described by a register, returns 0.
unsigned getRegisterForVar(const MDNode *Var) const;
unsigned getRegisterForVar(InlinedVariable Var) const;
bool empty() const { return VarInstrRanges.empty(); }
void clear() { VarInstrRanges.clear(); }

View File

@ -689,7 +689,7 @@ void DwarfCompileUnit::collectDeadVariables(DISubprogram SP) {
SPDIE = getDIE(SP);
assert(SPDIE);
for (DIVariable DV : Variables) {
DbgVariable NewVar(DV, DIExpression(), DD);
DbgVariable NewVar(DV, nullptr, DIExpression(), DD);
auto VariableDie = constructVariableDIE(NewVar);
applyVariableAttributes(NewVar, *VariableDie);
SPDIE->addChild(std::move(VariableDie));

View File

@ -489,7 +489,8 @@ void DwarfDebug::finishVariableDefinitions() {
// DIE::getUnit isn't simple - it walks parent pointers, etc.
DwarfCompileUnit *Unit = lookupUnit(VariableDie->getUnit());
assert(Unit);
DbgVariable *AbsVar = getExistingAbstractVariable(Var->getVariable());
DbgVariable *AbsVar = getExistingAbstractVariable(
InlinedVariable(Var->getVariable(), Var->getInlinedAt()));
if (AbsVar && AbsVar->getDIE()) {
Unit->addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin,
*AbsVar->getDIE());
@ -660,48 +661,43 @@ void DwarfDebug::endModule() {
}
// Find abstract variable, if any, associated with Var.
DbgVariable *DwarfDebug::getExistingAbstractVariable(const DIVariable &DV,
DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV,
DIVariable &Cleansed) {
LLVMContext &Ctx = DV->getContext();
// More then one inlined variable corresponds to one abstract variable.
// FIXME: This duplication of variables when inlining should probably be
// removed. It's done to allow each DIVariable to describe its location
// because the DebugLoc on the dbg.value/declare isn't accurate. We should
// make it accurate then remove this duplication/cleansing stuff.
Cleansed = cleanseInlinedVariable(DV, Ctx);
Cleansed = IV.first;
auto I = AbstractVariables.find(Cleansed);
if (I != AbstractVariables.end())
return I->second.get();
return nullptr;
}
DbgVariable *DwarfDebug::getExistingAbstractVariable(const DIVariable &DV) {
DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) {
DIVariable Cleansed;
return getExistingAbstractVariable(DV, Cleansed);
return getExistingAbstractVariable(IV, Cleansed);
}
void DwarfDebug::createAbstractVariable(const DIVariable &Var,
LexicalScope *Scope) {
auto AbsDbgVariable = make_unique<DbgVariable>(Var, DIExpression(), this);
auto AbsDbgVariable =
make_unique<DbgVariable>(Var, nullptr, DIExpression(), this);
InfoHolder.addScopeVariable(Scope, AbsDbgVariable.get());
AbstractVariables[Var] = std::move(AbsDbgVariable);
}
void DwarfDebug::ensureAbstractVariableIsCreated(const DIVariable &DV,
void DwarfDebug::ensureAbstractVariableIsCreated(InlinedVariable IV,
const MDNode *ScopeNode) {
DIVariable Cleansed = DV;
if (getExistingAbstractVariable(DV, Cleansed))
DIVariable Cleansed;
if (getExistingAbstractVariable(IV, Cleansed))
return;
createAbstractVariable(Cleansed, LScopes.getOrCreateAbstractScope(
cast<MDLocalScope>(ScopeNode)));
}
void
DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(const DIVariable &DV,
const MDNode *ScopeNode) {
DIVariable Cleansed = DV;
if (getExistingAbstractVariable(DV, Cleansed))
void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(
InlinedVariable IV, const MDNode *ScopeNode) {
DIVariable Cleansed;
if (getExistingAbstractVariable(IV, Cleansed))
return;
if (LexicalScope *Scope =
@ -711,11 +707,12 @@ DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(const DIVariable &DV,
// Collect variable information from side table maintained by MMI.
void DwarfDebug::collectVariableInfoFromMMITable(
SmallPtrSetImpl<const MDNode *> &Processed) {
DenseSet<InlinedVariable> &Processed) {
for (const auto &VI : MMI->getVariableDbgInfo()) {
if (!VI.Var)
continue;
Processed.insert(VI.Var);
InlinedVariable Var(VI.Var, VI.Loc ? VI.Loc->getInlinedAt() : nullptr);
Processed.insert(Var);
LexicalScope *Scope = LScopes.findLexicalScope(VI.Loc);
// If variable scope is not found then skip this variable.
@ -726,8 +723,9 @@ void DwarfDebug::collectVariableInfoFromMMITable(
assert(DV->isValidLocationForIntrinsic(VI.Loc) &&
"Expected inlined-at fields to agree");
DIExpression Expr = cast_or_null<MDExpression>(VI.Expr);
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
auto RegVar = make_unique<DbgVariable>(DV, Expr, this, VI.Slot);
ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode());
auto RegVar =
make_unique<DbgVariable>(Var.first, Var.second, Expr, this, VI.Slot);
if (InfoHolder.addScopeVariable(Scope, RegVar.get()))
ConcreteVariables.push_back(std::move(RegVar));
}
@ -877,35 +875,34 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
// Find variables for each lexical scope.
void
DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
SmallPtrSetImpl<const MDNode *> &Processed) {
void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
DenseSet<InlinedVariable> &Processed) {
// Grab the variable info that was squirreled away in the MMI side-table.
collectVariableInfoFromMMITable(Processed);
for (const auto &I : DbgValues) {
DIVariable DV = cast<MDLocalVariable>(I.first);
if (Processed.count(DV))
InlinedVariable IV = I.first;
if (Processed.count(IV))
continue;
// Instruction ranges, specifying where DV is accessible.
// Instruction ranges, specifying where IV is accessible.
const auto &Ranges = I.second;
if (Ranges.empty())
continue;
LexicalScope *Scope = nullptr;
if (MDLocation *IA = DV->getInlinedAt())
Scope = LScopes.findInlinedScope(DV->getScope(), IA);
if (const MDLocation *IA = IV.second)
Scope = LScopes.findInlinedScope(IV.first->getScope(), IA);
else
Scope = LScopes.findLexicalScope(DV->getScope());
Scope = LScopes.findLexicalScope(IV.first->getScope());
// If variable scope is not found then skip this variable.
if (!Scope)
continue;
Processed.insert(DV);
Processed.insert(IV);
const MachineInstr *MInsn = Ranges.front().first;
assert(MInsn->isDebugValue() && "History must begin with debug value");
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
ensureAbstractVariableIsCreatedIfScoped(IV, Scope->getScopeNode());
ConcreteVariables.push_back(make_unique<DbgVariable>(MInsn, this));
DbgVariable *RegVar = ConcreteVariables.back().get();
InfoHolder.addScopeVariable(Scope, RegVar);
@ -931,12 +928,14 @@ DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
// Collect info for variables that were optimized out.
for (DIVariable DV : SP->getVariables()) {
if (!Processed.insert(DV).second)
if (!Processed.insert(InlinedVariable(DV, nullptr)).second)
continue;
if (LexicalScope *Scope = LScopes.findLexicalScope(DV->getScope())) {
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
ensureAbstractVariableIsCreatedIfScoped(InlinedVariable(DV, nullptr),
Scope->getScopeNode());
DIExpression NoExpr;
ConcreteVariables.push_back(make_unique<DbgVariable>(DV, NoExpr, this));
ConcreteVariables.push_back(
make_unique<DbgVariable>(DV, nullptr, NoExpr, this));
InfoHolder.addScopeVariable(Scope, ConcreteVariables.back().get());
}
}
@ -1188,7 +1187,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
DISubprogram SP = cast<MDSubprogram>(FnScope->getScopeNode());
DwarfCompileUnit &TheCU = *SPMap.lookup(SP);
SmallPtrSet<const MDNode *, 16> ProcessedVars;
DenseSet<InlinedVariable> ProcessedVars;
collectVariableInfo(TheCU, SP, ProcessedVars);
// Add the range of this function to the list of ranges for the CU.
@ -1218,9 +1217,10 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
DISubprogram SP = cast<MDSubprogram>(AScope->getScopeNode());
// Collect info for variables that were optimized out.
for (DIVariable DV : SP->getVariables()) {
if (!ProcessedVars.insert(DV).second)
if (!ProcessedVars.insert(InlinedVariable(DV, nullptr)).second)
continue;
ensureAbstractVariableIsCreated(DV, DV->getScope());
ensureAbstractVariableIsCreated(InlinedVariable(DV, nullptr),
DV->getScope());
assert(LScopes.getAbstractScopesList().size() == NumAbstractScopes
&& "ensureAbstractVariableIsCreated inserted abstract scopes");
}

View File

@ -21,6 +21,7 @@
#include "DwarfAccelTable.h"
#include "DwarfFile.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallPtrSet.h"
@ -74,7 +75,8 @@ public:
/// - Variables that are described by multiple MMI table entries have multiple
/// expressions and frame indices.
class DbgVariable {
DIVariable Var; /// Variable Descriptor.
DIVariable Var; /// Variable Descriptor.
DILocation IA; /// Inlined at location.
SmallVector<DIExpression, 1> Expr; /// Complex address location expression.
DIE *TheDIE; /// Variable DIE.
unsigned DotDebugLocOffset; /// Offset in DotDebugLocEntries.
@ -84,9 +86,10 @@ class DbgVariable {
public:
/// Construct a DbgVariable from a DIVariable.
DbgVariable(DIVariable V, DIExpression E, DwarfDebug *DD, int FI = ~0)
: Var(V), Expr(1, E), TheDIE(nullptr), DotDebugLocOffset(~0U),
MInsn(nullptr), DD(DD) {
DbgVariable(DIVariable V, DILocation IA, DIExpression E, DwarfDebug *DD,
int FI = ~0)
: Var(V), IA(IA), Expr(1, E), TheDIE(nullptr), DotDebugLocOffset(~0U),
MInsn(nullptr), DD(DD) {
FrameIndex.push_back(FI);
assert(!E || E->isValid());
}
@ -95,13 +98,18 @@ public:
/// AbstractVar may be NULL.
DbgVariable(const MachineInstr *DbgValue, DwarfDebug *DD)
: Var(DbgValue->getDebugVariable()),
IA(DbgValue->getDebugLoc() ? DbgValue->getDebugLoc()->getInlinedAt()
: nullptr),
Expr(1, DbgValue->getDebugExpression()), TheDIE(nullptr),
DotDebugLocOffset(~0U), MInsn(DbgValue), DD(DD) {
FrameIndex.push_back(~0);
if (MDLocation *Loc = DbgValue->getDebugLoc())
IA = Loc->getInlinedAt();
}
// Accessors.
DIVariable getVariable() const { return Var; }
DILocation getInlinedAt() const { return IA; }
const ArrayRef<DIExpression> getExpression() const { return Expr; }
void setDIE(DIE &D) { TheDIE = &D; }
DIE *getDIE() const { return TheDIE; }
@ -115,6 +123,7 @@ public:
assert( DotDebugLocOffset == ~0U && !MInsn && "not an MMI entry");
assert(V.DotDebugLocOffset == ~0U && !V.MInsn && "not an MMI entry");
assert(V.Var == Var && "conflicting DIVariable");
assert(V.IA == IA && "conflicting inlined-at location");
if (V.getFrameIndex().back() != ~0) {
auto E = V.getExpression();
@ -323,14 +332,16 @@ class DwarfDebug : public AsmPrinterHandler {
return InfoHolder.getUnits();
}
typedef DbgValueHistoryMap::InlinedVariable InlinedVariable;
/// \brief Find abstract variable associated with Var.
DbgVariable *getExistingAbstractVariable(const DIVariable &DV,
DbgVariable *getExistingAbstractVariable(InlinedVariable IV,
DIVariable &Cleansed);
DbgVariable *getExistingAbstractVariable(const DIVariable &DV);
DbgVariable *getExistingAbstractVariable(InlinedVariable IV);
void createAbstractVariable(const DIVariable &DV, LexicalScope *Scope);
void ensureAbstractVariableIsCreated(const DIVariable &Var,
void ensureAbstractVariableIsCreated(InlinedVariable Var,
const MDNode *Scope);
void ensureAbstractVariableIsCreatedIfScoped(const DIVariable &Var,
void ensureAbstractVariableIsCreatedIfScoped(InlinedVariable Var,
const MDNode *Scope);
/// \brief Construct a DIE for this abstract scope.
@ -460,7 +471,7 @@ class DwarfDebug : public AsmPrinterHandler {
/// \brief Populate LexicalScope entries with variables' info.
void collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
SmallPtrSetImpl<const MDNode *> &ProcessedVars);
DenseSet<InlinedVariable> &ProcessedVars);
/// \brief Build the location list for all DBG_VALUEs in the
/// function that describe the same variable.
@ -469,7 +480,7 @@ class DwarfDebug : public AsmPrinterHandler {
/// \brief Collect variable information from the side table maintained
/// by MMI.
void collectVariableInfoFromMMITable(SmallPtrSetImpl<const MDNode *> &P);
void collectVariableInfoFromMMITable(DenseSet<InlinedVariable> &P);
/// \brief Ensure that a label will be emitted before MI.
void requestLabelBeforeInsn(const MachineInstr *MI) {

View File

@ -378,12 +378,13 @@ static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS,
CommentOS << " ]";
}
static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V) {
static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V,
const MDLocation *DL) {
const LLVMContext &Ctx = V->getContext();
StringRef Res = V->getName();
if (!Res.empty())
OS << Res << "," << V->getLine();
if (auto *InlinedAt = V->getInlinedAt()) {
if (auto *InlinedAt = DL->getInlinedAt()) {
if (DebugLoc InlinedAtDL = InlinedAt) {
OS << " @[";
printDebugLoc(InlinedAtDL, OS, Ctx);
@ -395,7 +396,7 @@ static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V) {
void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) {
DIVariable DV = cast<MDLocalVariable>(Variable);
OS << "!\"";
printExtendedName(OS, DV);
printExtendedName(OS, DV, dl);
OS << "\"\t";
if (offset)

View File

@ -1712,7 +1712,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
if (!HaveSemi) OS << ";";
DIVariable DV = cast<MDLocalVariable>(getOperand(e - 2).getMetadata());
OS << " line no:" << DV->getLine();
if (auto *InlinedAt = DV->getInlinedAt()) {
if (auto *InlinedAt = debugLoc->getInlinedAt()) {
DebugLoc InlinedAtDL(InlinedAt);
if (InlinedAtDL && MF) {
OS << " inlined @[ ";

View File

@ -1745,7 +1745,6 @@ static void writeMDLocalVariable(raw_ostream &Out, const MDLocalVariable *N,
Printer.printInt("line", N->getLine());
Printer.printMetadata("type", N->getRawType());
Printer.printDIFlags("flags", N->getFlags());
Printer.printMetadata("inlinedAt", N->getRawInlinedAt());
Out << ")";
}

View File

@ -35,16 +35,6 @@ using namespace llvm::dwarf;
DIScopeRef DIScope::getRef() const { return MDScopeRef::get(get()); }
DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
LLVMContext &VMContext) {
return cast<MDLocalVariable>(DV)
->withInline(cast_or_null<MDLocation>(InlinedScope));
}
DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) {
return cast<MDLocalVariable>(DV)->withoutInline();
}
DISubprogram llvm::getDISubprogram(const MDNode *Scope) {
if (auto *LocalScope = dyn_cast_or_null<MDLocalScope>(Scope))
return LocalScope->getSubprogram();

View File

@ -450,10 +450,12 @@ MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
Ops);
}
MDLocalVariable *MDLocalVariable::getImpl(
LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name,
Metadata *File, unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags,
Metadata *InlinedAt, StorageType Storage, bool ShouldCreate) {
MDLocalVariable *MDLocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
Metadata *Scope, MDString *Name,
Metadata *File, unsigned Line,
Metadata *Type, unsigned Arg,
unsigned Flags, StorageType Storage,
bool ShouldCreate) {
// Truncate Arg to 8 bits.
//
// FIXME: This is gross (and should be changed to an assert or removed), but
@ -463,8 +465,8 @@ MDLocalVariable *MDLocalVariable::getImpl(
assert(Scope && "Expected scope");
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(MDLocalVariable, (Tag, Scope, getString(Name), File,
Line, Type, Arg, Flags, InlinedAt));
Metadata *Ops[] = {Scope, Name, File, Type, InlinedAt};
Line, Type, Arg, Flags));
Metadata *Ops[] = {Scope, Name, File, Type};
DEFINE_GETIMPL_STORE(MDLocalVariable, (Tag, Line, Arg, Flags), Ops);
}

View File

@ -736,29 +736,24 @@ template <> struct MDNodeKeyImpl<MDLocalVariable> {
Metadata *Type;
unsigned Arg;
unsigned Flags;
Metadata *InlinedAt;
MDNodeKeyImpl(unsigned Tag, Metadata *Scope, StringRef Name, Metadata *File,
unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags,
Metadata *InlinedAt)
unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags)
: Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type),
Arg(Arg), Flags(Flags), InlinedAt(InlinedAt) {}
Arg(Arg), Flags(Flags) {}
MDNodeKeyImpl(const MDLocalVariable *N)
: Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()),
File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()),
Arg(N->getArg()), Flags(N->getFlags()),
InlinedAt(N->getRawInlinedAt()) {}
Arg(N->getArg()), Flags(N->getFlags()) {}
bool isKeyOf(const MDLocalVariable *RHS) const {
return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
Name == RHS->getName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && Type == RHS->getRawType() &&
Arg == RHS->getArg() && Flags == RHS->getFlags() &&
InlinedAt == RHS->getRawInlinedAt();
Arg == RHS->getArg() && Flags == RHS->getFlags();
}
unsigned getHashValue() const {
return hash_combine(Tag, Scope, Name, File, Line, Type, Arg, Flags,
InlinedAt);
return hash_combine(Tag, Scope, Name, File, Line, Type, Arg, Flags);
}
};

View File

@ -1075,9 +1075,6 @@ void Verifier::visitMDLocalVariable(const MDLocalVariable &N) {
"invalid tag", &N);
Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()),
"local variable requires a valid scope", &N, N.getRawScope());
if (auto *IA = N.getRawInlinedAt())
Assert(isa<MDLocation>(IA), "local variable requires a valid scope", &N,
IA);
}
void Verifier::visitMDExpression(const MDExpression &N) {
@ -3401,17 +3398,12 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII) {
BasicBlock *BB = DII.getParent();
Function *F = BB ? BB->getParent() : nullptr;
// The inlined-at attachments for variables and !dbg attachments must agree.
// The scopes for variables and !dbg attachments must agree.
MDLocalVariable *Var = DII.getVariable();
MDLocation *VarIA = Var->getInlinedAt();
MDLocation *Loc = DII.getDebugLoc();
Assert(Loc, "llvm.dbg." + Kind + " intrinsic requires a !dbg attachment",
&DII, BB, F);
MDLocation *LocIA = Loc->getInlinedAt();
Assert(VarIA == LocIA, "mismatched variable and !dbg inlined-at", &DII, BB, F,
Var, VarIA, Loc, LocIA);
MDSubprogram *VarSP = getSubprogram(Var->getRawScope());
MDSubprogram *LocSP = getSubprogram(Loc->getRawScope());
if (!VarSP || !LocSP)

View File

@ -904,19 +904,6 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
BI->setDebugLoc(TheCallDL);
} else {
BI->setDebugLoc(updateInlinedAtInfo(DL, InlinedAtNode, BI->getContext(), IANodes));
if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(BI)) {
LLVMContext &Ctx = BI->getContext();
MDNode *InlinedAt = BI->getDebugLoc().getInlinedAt();
DVI->setOperand(2, MetadataAsValue::get(
Ctx, createInlinedVariable(DVI->getVariable(),
InlinedAt, Ctx)));
} else if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI)) {
LLVMContext &Ctx = BI->getContext();
MDNode *InlinedAt = BI->getDebugLoc().getInlinedAt();
DDI->setOperand(1, MetadataAsValue::get(
Ctx, createInlinedVariable(DDI->getVariable(),
InlinedAt, Ctx)));
}
}
}
}

View File

@ -12,13 +12,13 @@
!3 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!4 = !MDLocation(scope: !0)
; CHECK: !5 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 3, scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial, inlinedAt: !4)
; CHECK: !6 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "foo", scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial, inlinedAt: !4)
; CHECK: !5 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 3, scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial)
; CHECK: !6 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "foo", scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial)
!5 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 3,
scope: !0, file: !2, line: 7, type: !3,
flags: DIFlagArtificial, inlinedAt: !4)
flags: DIFlagArtificial)
!6 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "foo", scope: !0,
file: !2, line: 7, type: !3, flags: DIFlagArtificial, inlinedAt: !4)
file: !2, line: 7, type: !3, flags: DIFlagArtificial)
; CHECK: !7 = !MDLocalVariable(tag: DW_TAG_arg_variable, arg: 0, scope: !0)
; CHECK: !8 = !MDLocalVariable(tag: DW_TAG_auto_variable, scope: !0)

View File

@ -82,9 +82,9 @@ declare i32 @puts(i8* nocapture) nounwind
!20 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", line: 4, arg: 2, scope: !9, file: !1, type: !7)
!21 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "c", line: 4, arg: 3, scope: !9, file: !1, type: !8)
!49 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "ptr", line: 4, arg: 1, scope: !9, file: !1, type: !6, inlinedAt: !37)
!50 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", line: 4, arg: 2, scope: !9, file: !1, type: !7, inlinedAt: !37)
!51 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "c", line: 4, arg: 2, scope: !9, file: !1, type: !8, inlinedAt: !37)
!49 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "ptr", line: 4, arg: 1, scope: !9, file: !1, type: !6)
!50 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", line: 4, arg: 2, scope: !9, file: !1, type: !7)
!51 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "c", line: 4, arg: 2, scope: !9, file: !1, type: !8)
!22 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argc", line: 17, arg: 0, scope: !10, file: !1, type: !5)
!23 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argv", line: 17, arg: 0, scope: !10, file: !1, type: !13)

View File

@ -80,9 +80,9 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
!12 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "c", line: 4, arg: 3, scope: !0, file: !1, type: !13)
!13 = !MDBasicType(tag: DW_TAG_base_type, name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
!58 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "ptr", line: 4, arg: 1, scope: !0, file: !1, type: !9, inlinedAt: !40)
!60 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", line: 4, arg: 2, scope: !0, file: !1, type: !11, inlinedAt: !40)
!62 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "c", line: 4, arg: 3, scope: !0, file: !1, type: !13, inlinedAt: !40)
!58 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "ptr", line: 4, arg: 1, scope: !0, file: !1, type: !9)
!60 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", line: 4, arg: 2, scope: !0, file: !1, type: !11)
!62 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "c", line: 4, arg: 3, scope: !0, file: !1, type: !13)
!14 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "ptr", line: 11, arg: 1, scope: !6, file: !1, type: !9)
!15 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", line: 11, arg: 2, scope: !6, file: !1, type: !11)

View File

@ -169,36 +169,36 @@ attributes #2 = { nounwind readnone }
!53 = distinct !MDLexicalBlock(line: 14, column: 0, file: !1, scope: !51)
!54 = !MDLocation(line: 16, scope: !53)
!55 = !MDLocation(line: 17, scope: !24)
!56 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !40, type: !38, inlinedAt: !55)
!56 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !40, type: !38)
!57 = !MDLocation(line: 0, scope: !40, inlinedAt: !55)
!58 = !{i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)}
!59 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 5, arg: 2, scope: !40, file: !25, type: !15, inlinedAt: !55)
!59 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 5, arg: 2, scope: !40, file: !25, type: !15)
!60 = !MDLocation(line: 5, scope: !40, inlinedAt: !55)
!61 = !MDLocation(line: 5, scope: !62, inlinedAt: !55)
!62 = distinct !MDLexicalBlock(line: 5, column: 0, file: !1, scope: !40)
!63 = !MDLocation(line: 18, scope: !24)
!64 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !40, type: !38, inlinedAt: !63)
!64 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !40, type: !38)
!65 = !MDLocation(line: 0, scope: !40, inlinedAt: !63)
!66 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 5, arg: 2, scope: !40, file: !25, type: !15, inlinedAt: !63)
!66 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 5, arg: 2, scope: !40, file: !25, type: !15)
!67 = !MDLocation(line: 5, scope: !40, inlinedAt: !63)
!68 = !MDLocation(line: 5, scope: !62, inlinedAt: !63)
!69 = !MDLocation(line: 20, scope: !70)
!70 = distinct !MDLexicalBlock(line: 20, column: 0, file: !1, scope: !24)
!71 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38, inlinedAt: !72)
!71 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38)
!72 = !MDLocation(line: 21, scope: !70)
!73 = !MDLocation(line: 0, scope: !35, inlinedAt: !72)
!74 = !{i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str1, i64 0, i64 0)}
!75 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15, inlinedAt: !72)
!75 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15)
!76 = !MDLocation(line: 6, scope: !35, inlinedAt: !72)
!77 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38, inlinedAt: !78)
!77 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38)
!78 = !MDLocation(line: 23, scope: !70)
!79 = !MDLocation(line: 0, scope: !35, inlinedAt: !78)
!80 = !{i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str2, i64 0, i64 0)}
!81 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15, inlinedAt: !78)
!81 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15)
!82 = !MDLocation(line: 6, scope: !35, inlinedAt: !78)
!83 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38, inlinedAt: !84)
!83 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38)
!84 = !MDLocation(line: 24, scope: !24)
!85 = !MDLocation(line: 0, scope: !35, inlinedAt: !84)
!86 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15, inlinedAt: !84)
!86 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15)
!87 = !MDLocation(line: 6, scope: !35, inlinedAt: !84)
!88 = !MDLocation(line: 25, scope: !24)

View File

@ -48,7 +48,7 @@ attributes #0 = { sspreq }
!20 = !{}
!21 = !{i32 2, !"Dwarf Version", i32 2}
!22 = !{i64* getelementptr inbounds ({ i64, [56 x i8] }, { i64, [56 x i8] }* @a, i32 0, i32 0)}
!23 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p2", line: 12, arg: 2, scope: !24, file: !10, type: !32, inlinedAt: !38)
!23 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p2", line: 12, arg: 2, scope: !24, file: !10, type: !32)
!24 = !MDSubprogram(name: "min<unsigned long long>", linkageName: "_ZN3__13minIyEERKT_S3_RS1_", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 12, file: !1, scope: !25, type: !27, templateParams: !33, variables: !35)
!25 = !MDNamespace(name: "__1", line: 1, file: !26, scope: null)
!26 = !MDFile(filename: "main.cpp", directory: "/Users/matt/ryan_bug")
@ -85,7 +85,7 @@ attributes #0 = { sspreq }
!58 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p3", line: 8, arg: 3, scope: !41, file: !10, type: !44)
!59 = !MDLocation(line: 13, scope: !24, inlinedAt: !38)
!63 = !{i32 undef}
!64 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p1", line: 1, arg: 2, scope: !65, file: !10, type: !50, inlinedAt: !40)
!64 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p1", line: 1, arg: 2, scope: !65, file: !10, type: !50)
!65 = !MDSubprogram(name: "operator()", linkageName: "_ZN3__11AclERKiS2_", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !1, scope: !25, type: !47, declaration: !46, variables: !66)
!66 = !{!67, !69, !70}
!67 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !65, type: !68)

View File

@ -58,7 +58,7 @@ declare void @uuid_LtoB(i8*, i8*)
!5 = !MDSubroutineType(types: !6)
!6 = !{null}
!7 = !MDLocation(line: 810, scope: !1)
!8 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "data", line: 201, arg: 0, scope: !9, file: !10, type: !11, inlinedAt: !7)
!8 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "data", line: 201, arg: 0, scope: !9, file: !10, type: !11)
!9 = !MDSubprogram(name: "_OSSwapInt64", linkageName: "_OSSwapInt64", line: 202, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !10, scope: null, type: !5)
!10 = !MDFile(filename: "OSByteOrder.h", directory: "/usr/include/libkern/ppc")
!11 = !MDDerivedType(tag: DW_TAG_typedef, name: "uint64_t", line: 59, file: !36, scope: !3, baseType: !13)

View File

@ -37,8 +37,8 @@ entry:
!9 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5)
!10 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12)
!59 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5, inlinedAt: !17)
!60 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12, inlinedAt: !17)
!59 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5)
!60 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12)
!11 = distinct !MDLexicalBlock(line: 9, column: 0, file: !1, scope: !0)
!12 = !MDCompositeType(tag: DW_TAG_structure_type, name: "X", line: 10, size: 64, align: 32, file: !27, scope: !0, elements: !13)

View File

@ -106,7 +106,7 @@ attributes #3 = { nounwind }
!42 = !{!"vtable pointer", !43, i64 0}
!43 = !{!"Simple C/C++ TBAA"}
!44 = !MDLocation(line: 0, scope: !32)
!45 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31, inlinedAt: !46)
!45 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31)
!46 = !MDLocation(line: 9, scope: !32)
!47 = !MDLocation(line: 0, scope: !28, inlinedAt: !46)
!48 = !MDLocation(line: 9, scope: !28, inlinedAt: !46)

View File

@ -234,7 +234,7 @@ attributes #5 = { builtin }
!71 = !MDLocation(line: 15, column: 3, scope: !25, inlinedAt: !66)
!72 = !MDLocation(line: 16, column: 1, scope: !25, inlinedAt: !66)
!73 = !MDLocation(line: 17, column: 27, scope: !31)
!74 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p1", line: 17, arg: 1, scope: !31, file: !26, type: !"_ZTS1A", inlinedAt: !75)
!74 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p1", line: 17, arg: 1, scope: !31, file: !26, type: !"_ZTS1A")
!75 = distinct !MDLocation(line: 22, column: 3, scope: !34)
!76 = !MDExpression(DW_OP_bit_piece, 8, 120)
!77 = !MDLocation(line: 17, column: 12, scope: !31, inlinedAt: !75)

View File

@ -109,7 +109,7 @@ attributes #3 = { nounwind }
!44 = !{!"vtable pointer", !45, i64 0}
!45 = !{!"Simple C/C++ TBAA"}
!46 = !MDLocation(line: 0, scope: !32)
!47 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31, inlinedAt: !48)
!47 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31)
!48 = !MDLocation(line: 9, scope: !32)
!49 = !MDLocation(line: 0, scope: !28, inlinedAt: !48)
!50 = !MDLocation(line: 9, scope: !28, inlinedAt: !48)

View File

@ -37,8 +37,8 @@ entry:
!9 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5)
!10 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12)
!59 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5, inlinedAt: !17)
!60 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12, inlinedAt: !17)
!59 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5)
!60 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12)
!11 = distinct !MDLexicalBlock(line: 9, column: 0, file: !1, scope: !0)
!12 = !MDCompositeType(tag: DW_TAG_structure_type, name: "X", line: 10, size: 64, align: 32, file: !27, scope: !0, elements: !13)

View File

@ -155,9 +155,9 @@ attributes #2 = { nounwind readnone }
!32 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
!33 = !MDLocation(line: 0, scope: !16, inlinedAt: !21)
!129 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30, inlinedAt: !22)
!132 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30, inlinedAt: !21)
!232 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30, inlinedAt: !37)
!129 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
!132 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
!232 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
!34 = !MDLocation(line: 5, scope: !35)
!35 = distinct !MDLexicalBlock(line: 5, column: 0, file: !5, scope: !36)

View File

@ -37,8 +37,8 @@ entry:
!9 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5)
!10 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12)
!109 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5, inlinedAt: !17)
!110 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12, inlinedAt: !17)
!109 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "j", line: 9, arg: 0, scope: !0, file: !1, type: !5)
!110 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "xyz", line: 10, scope: !11, file: !1, type: !12)
!11 = distinct !MDLexicalBlock(line: 9, column: 0, file: !1, scope: !0)
!12 = !MDCompositeType(tag: DW_TAG_structure_type, name: "X", line: 10, size: 64, align: 32, file: !27, scope: !0, elements: !13)

View File

@ -61,8 +61,8 @@ declare float* @bar(i32) optsize
define void @foobar() nounwind optsize ssp {
entry:
tail call void @llvm.dbg.value(metadata %struct.S1* @p, i64 0, metadata !109, metadata !MDExpression()) nounwind, !dbg !31
tail call void @llvm.dbg.value(metadata i32 1, i64 0, metadata !118, metadata !MDExpression()) nounwind, !dbg !35
tail call void @llvm.dbg.value(metadata %struct.S1* @p, i64 0, metadata !9, metadata !MDExpression()) nounwind, !dbg !31
tail call void @llvm.dbg.value(metadata i32 1, i64 0, metadata !18, metadata !MDExpression()) nounwind, !dbg !35
store i32 1, i32* getelementptr inbounds (%struct.S1, %struct.S1* @p, i64 0, i32 1), align 8, !dbg !36
%call.i = tail call float* @bar(i32 1) nounwind optsize, !dbg !37
store float* %call.i, float** getelementptr inbounds (%struct.S1, %struct.S1* @p, i64 0, i32 0), align 8, !dbg !37
@ -84,9 +84,6 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
!7 = !MDSubroutineType(types: !8)
!8 = !{null}
!9 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "sp", line: 7, arg: 1, scope: !0, file: !1, type: !10)
!109 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "sp", line: 7, arg: 1, scope: !0, file: !1, type: !10, inlinedAt: !32)
!10 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !2, baseType: !11)
!11 = !MDDerivedType(tag: DW_TAG_typedef, name: "S1", line: 4, file: !42, scope: !2, baseType: !12)
!12 = !MDCompositeType(tag: DW_TAG_structure_type, name: "S1", line: 1, size: 128, align: 64, file: !42, scope: !2, elements: !13)
@ -96,9 +93,6 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
!16 = !MDBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
!17 = !MDDerivedType(tag: DW_TAG_member, name: "nums", line: 3, size: 32, align: 32, offset: 64, file: !42, scope: !1, baseType: !5)
!18 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "nums", line: 7, arg: 2, scope: !0, file: !1, type: !5)
!118 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "nums", line: 7, arg: 2, scope: !0, file: !1, type: !5, inlinedAt: !32)
!19 = !MDGlobalVariable(name: "p", line: 14, isLocal: false, isDefinition: true, scope: !2, file: !1, type: !11, variable: %struct.S1* @p)
!20 = !MDLocation(line: 7, column: 13, scope: !0)
!21 = !MDLocation(line: 7, column: 21, scope: !0)

View File

@ -234,7 +234,7 @@ attributes #4 = { builtin }
!29 = !MDLocation(line: 7, scope: !4)
!30 = !MDLocation(line: 4, scope: !4, inlinedAt: !31)
!31 = !MDLocation(line: 10, scope: !13)
!32 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "p", line: 4, scope: !4, file: !5, type: !10, inlinedAt: !31)
!32 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "p", line: 4, scope: !4, file: !5, type: !10)
!33 = !MDLocation(line: 5, scope: !21, inlinedAt: !31)
!34 = !MDLocation(line: 6, scope: !21, inlinedAt: !31)
!35 = !MDLocation(line: 7, scope: !4, inlinedAt: !31)

View File

@ -88,8 +88,8 @@ attributes #1 = { nounwind readnone }
!21 = !{i32 1, !"Debug Info Version", i32 3}
!22 = !{!"clang version 3.5.0 "}
!23 = !MDLocation(line: 8, scope: !13)
!24 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !25, inlinedAt: !23)
!24 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !25)
!25 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS3foo")
!26 = !MDLocation(line: 0, scope: !17, inlinedAt: !23)
!27 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 2, arg: 2, scope: !17, file: !14, type: !9, inlinedAt: !23)
!27 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 2, arg: 2, scope: !17, file: !14, type: !9)
!28 = !MDLocation(line: 2, scope: !17, inlinedAt: !23)

View File

@ -67,7 +67,7 @@ attributes #1 = { nounwind readnone }
!16 = !MDDerivedType(tag: DW_TAG_volatile_type, baseType: !11)
!17 = !MDLocation(line: 5, scope: !4)
!18 = !MDLocation(line: 6, column: 7, scope: !4)
!19 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 1, arg: 1, scope: !8, file: !5, type: !11, inlinedAt: !18)
!19 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 1, arg: 1, scope: !8, file: !5, type: !11)
!20 = !MDLocation(line: 1, scope: !8, inlinedAt: !18)
!21 = !MDLocation(line: 2, scope: !8, inlinedAt: !18)
!22 = !MDLocation(line: 7, scope: !4)

View File

@ -50,7 +50,7 @@ attributes #1 = { nounwind readnone }
!16 = !{!"clang version 3.7.0 (trunk 233919) (llvm/trunk 233920)"}
!17 = !MDExpression()
!18 = !MDLocation(line: 2, column: 13, scope: !4)
!19 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1, scope: !10, file: !1, line: 1, type: !7, inlinedAt: !20)
!19 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1, scope: !10, file: !1, line: 1, type: !7)
!20 = distinct !MDLocation(line: 2, column: 25, scope: !4)
!21 = !MDLocation(line: 1, column: 20, scope: !10, inlinedAt: !20)
!22 = !MDLocation(line: 2, column: 18, scope: !4)

View File

@ -124,7 +124,7 @@ attributes #3 = { nounwind }
!24 = !{i32 2, !"Debug Info Version", i32 3}
!25 = !{!"clang version 3.5.0 "}
!26 = !MDLocation(line: 15, scope: !11)
!27 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "lhs", line: 13, arg: 1, scope: !17, file: !12, type: !20, inlinedAt: !28)
!27 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "lhs", line: 13, arg: 1, scope: !17, file: !12, type: !20)
!28 = !MDLocation(line: 16, scope: !11)
!29 = !MDLocation(line: 13, scope: !17, inlinedAt: !28)
!30 = !MDLocation(line: 17, scope: !11)

View File

@ -196,7 +196,7 @@ attributes #3 = { ssp uwtable }
!57 = !MDLocation(line: 23, column: 15, scope: !24)
!58 = !MDLocation(line: 23, column: 7, scope: !24)
!59 = !MDLocation(line: 24, column: 9, scope: !24)
!60 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p5", line: 7, arg: 1, scope: !11, file: !12, type: !"_ZTS1A", inlinedAt: !61)
!60 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p5", line: 7, arg: 1, scope: !11, file: !12, type: !"_ZTS1A")
!61 = distinct !MDLocation(line: 26, column: 7, scope: !24)
!62 = !MDLocation(line: 7, column: 42, scope: !11, inlinedAt: !61)
!63 = !MDLocation(line: 7, column: 48, scope: !11, inlinedAt: !61)

View File

@ -236,7 +236,7 @@ attributes #3 = { nounwind }
!34 = !{!"any pointer", !35, i64 0}
!35 = !{!"omnipotent char", !36, i64 0}
!36 = !{!"Simple C/C++ TBAA"}
!37 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !22, type: !25, inlinedAt: !32)
!37 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !22, type: !25)
!38 = !MDLocation(line: 0, scope: !22, inlinedAt: !32)
!39 = !MDLocation(line: 8, scope: !22, inlinedAt: !32)
!40 = !MDLocation(line: 9, scope: !41, inlinedAt: !32)
@ -256,7 +256,7 @@ attributes #3 = { nounwind }
!54 = !MDLocation(line: 20, scope: !18, inlinedAt: !55)
!55 = !MDLocation(line: 10, scope: !22)
!56 = !MDLocation(line: 17, scope: !14, inlinedAt: !54)
!57 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !22, type: !25, inlinedAt: !56)
!57 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !22, type: !25)
!58 = !MDLocation(line: 0, scope: !22, inlinedAt: !56)
!59 = !MDLocation(line: 8, scope: !22, inlinedAt: !56)
!60 = !MDLocation(line: 9, scope: !41, inlinedAt: !56)
@ -266,7 +266,7 @@ attributes #3 = { nounwind }
!64 = !MDLocation(line: 16, scope: !14, inlinedAt: !65)
!65 = !MDLocation(line: 20, scope: !18)
!66 = !MDLocation(line: 17, scope: !14, inlinedAt: !65)
!67 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !22, type: !25, inlinedAt: !66)
!67 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !22, type: !25)
!68 = !MDLocation(line: 0, scope: !22, inlinedAt: !66)
!69 = !MDLocation(line: 8, scope: !22, inlinedAt: !66)
!70 = !MDLocation(line: 9, scope: !41, inlinedAt: !66)

View File

@ -134,7 +134,7 @@ attributes #3 = { nounwind }
!19 = !MDLocation(line: 4, scope: !4)
!20 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 1, arg: 1, scope: !12, file: !13, type: !8)
!120 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 1, arg: 1, scope: !12, file: !13, type: !8, inlinedAt: !19)
!120 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 1, arg: 1, scope: !12, file: !13, type: !8)
!21 = !MDLocation(line: 1, scope: !12, inlinedAt: !19)
!22 = !MDLocation(line: 2, scope: !12, inlinedAt: !19)

View File

@ -111,7 +111,7 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
!13 = !{i32 2, !"Dwarf Version", i32 4}
!14 = !{i32 1, !"Debug Info Version", i32 3}
!15 = !{!"clang version 3.5.0 "}
!16 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "b", line: 3, scope: !17, file: !11, type: !18, inlinedAt: !20)
!16 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "b", line: 3, scope: !17, file: !11, type: !18)
!17 = distinct !MDLexicalBlock(line: 3, column: 0, file: !1, scope: !12)
!18 = !MDBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
!19 = !MDLocation(line: 3, scope: !17, inlinedAt: !20)
@ -119,7 +119,7 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
!21 = !MDLocation(line: 4, scope: !17, inlinedAt: !20)
!22 = !MDLocation(line: 5, scope: !12, inlinedAt: !20)
!23 = !MDLocation(line: 6, scope: !12, inlinedAt: !20)
!24 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "b", line: 2, scope: !25, file: !6, type: !18, inlinedAt: !28)
!24 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "b", line: 2, scope: !25, file: !6, type: !18)
!25 = distinct !MDLexicalBlock(line: 2, column: 0, file: !5, scope: !26)
!26 = !MDLexicalBlockFile(discriminator: 0, file: !5, scope: !10)
!27 = !MDLocation(line: 2, scope: !25, inlinedAt: !28)

View File

@ -66,11 +66,11 @@ attributes #2 = { nounwind readnone }
!13 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 6, arg: 1, scope: !8, file: !5, type: !11)
!14 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 6, arg: 2, scope: !8, file: !5, type: !11)
!15 = !{i32 undef}
!16 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 6, arg: 1, scope: !8, file: !5, type: !11, inlinedAt: !17)
!16 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 6, arg: 1, scope: !8, file: !5, type: !11)
!17 = !MDLocation(line: 4, scope: !4)
!18 = !MDLocation(line: 6, scope: !8, inlinedAt: !17)
!19 = !{i32 2}
!20 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 6, arg: 2, scope: !8, file: !5, type: !11, inlinedAt: !17)
!20 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 6, arg: 2, scope: !8, file: !5, type: !11)
!21 = !MDLocation(line: 7, scope: !8, inlinedAt: !17)
!22 = !MDLocation(line: 5, scope: !4)
!23 = !MDLocation(line: 6, scope: !8)

View File

@ -45,10 +45,10 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnon
; VARIABLE: {{.*Abbrev.*DW_TAG_variable}}
; VARIABLE-NOT: {{.*Abbrev.*DW_TAG_variable}}
!18 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argument", line: 3, arg: 1, scope: !10, file: !6, type: !9, inlinedAt: !19)
!18 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argument", line: 3, arg: 1, scope: !10, file: !6, type: !9)
!19 = !MDLocation(line: 11, column: 10, scope: !5)
!21 = !MDLocation(line: 3, column: 25, scope: !10, inlinedAt: !19)
!22 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "local", line: 4, scope: !10, file: !6, type: !9, inlinedAt: !19)
!22 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "local", line: 4, scope: !10, file: !6, type: !9)
!23 = !MDLocation(line: 4, column: 16, scope: !10, inlinedAt: !19)
!24 = !MDLocation(line: 5, column: 3, scope: !10, inlinedAt: !19)
!25 = !MDLocation(line: 6, column: 3, scope: !10, inlinedAt: !19)

View File

@ -160,13 +160,13 @@ attributes #2 = { nounwind readnone }
!22 = !{i32 2, !"Debug Info Version", i32 3}
!23 = !{!"clang version 3.5.0 "}
!24 = !{i1 false}
!25 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 5, arg: 1, scope: !14, file: !5, type: !11, inlinedAt: !26)
!25 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 5, arg: 1, scope: !14, file: !5, type: !11)
!26 = !MDLocation(line: 14, scope: !4)
!27 = !MDLocation(line: 5, scope: !14, inlinedAt: !26)
!28 = !MDLocation(line: 10, scope: !14, inlinedAt: !26)
!29 = !MDLocation(line: 15, scope: !4)
!30 = !MDLocation(line: 17, scope: !8)
!31 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 5, arg: 1, scope: !14, file: !5, type: !11, inlinedAt: !32)
!31 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 5, arg: 1, scope: !14, file: !5, type: !11)
!32 = !MDLocation(line: 18, scope: !8)
!33 = !MDLocation(line: 5, scope: !14, inlinedAt: !32)
!34 = !MDLocation(line: 6, scope: !19, inlinedAt: !32)
@ -175,7 +175,7 @@ attributes #2 = { nounwind readnone }
!37 = !{!"int", !38, i64 0}
!38 = !{!"omnipotent char", !39, i64 0}
!39 = !{!"Simple C/C++ TBAA"}
!40 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "s", line: 7, scope: !18, file: !5, type: !20, inlinedAt: !32)
!40 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "s", line: 7, scope: !18, file: !5, type: !20)
!41 = !MDLocation(line: 8, scope: !18, inlinedAt: !32)
!42 = !MDLocation(line: 9, scope: !18, inlinedAt: !32)
!43 = !MDLocation(line: 10, scope: !14, inlinedAt: !32)

View File

@ -89,7 +89,7 @@ attributes #2 = { nounwind readnone }
!16 = !MDLocation(line: 5, scope: !4)
!17 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "i", line: 6, arg: 1, scope: !9, file: !5, type: !8)
!117 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "i", line: 6, arg: 1, scope: !9, file: !5, type: !8, inlinedAt: !16)
!117 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "i", line: 6, arg: 1, scope: !9, file: !5, type: !8)
!18 = !MDLocation(line: 6, scope: !9, inlinedAt: !16)
!19 = !MDLocation(line: 6, scope: !9)

View File

@ -128,7 +128,7 @@ attributes #3 = { noreturn nounwind }
!43 = !{!37, !37, i64 0}
!44 = !{!38, !38, i64 0}
!45 = !MDLocation(line: 9, scope: !15)
!46 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p1", line: 6, arg: 1, scope: !15, file: !16, type: !"_ZTS1A", inlinedAt: !47)
!46 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "p1", line: 6, arg: 1, scope: !15, file: !16, type: !"_ZTS1A")
!47 = distinct !MDLocation(line: 11, scope: !21)
!48 = !MDExpression(DW_OP_bit_piece, 32, 160)
!49 = !MDLocation(line: 6, scope: !15, inlinedAt: !47)

View File

@ -94,6 +94,6 @@ attributes #1 = { nounwind readnone }
; CHECK: [[FOO:![0-9]+]] = !MDSubprogram(name: "foo",
; CHECK: [[BAR:![0-9]+]] = !MDSubprogram(name: "bar",
; CHECK: [[m23]] = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1, scope: [[FOO]]
; CHECK: [[CALL_SITE:![0-9]+]] = distinct !MDLocation(line: 8, column: 14, scope: [[BAR]])
; CHECK: [[m23]] = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1, scope: [[FOO]],{{.*}} inlinedAt: [[CALL_SITE]])
; CHECK: [[m24]] = !MDLocation(line: 1, column: 17, scope: [[FOO]], inlinedAt: [[CALL_SITE]])

View File

@ -41,15 +41,15 @@ return: ; preds = %entry
!6 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!7 = !MDLocation(line: 8, scope: !1)
!8 = !MDLocation(line: 9, scope: !1)
!9 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 4, arg: 0, scope: !10, file: !2, type: !6, inlinedAt: !8)
!9 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 4, arg: 0, scope: !10, file: !2, type: !6)
!10 = !MDSubprogram(name: "bar", linkageName: "bar", line: 4, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 4, file: !20, scope: !2, type: !11)
!11 = !MDSubroutineType(types: !12)
!12 = !{null, !6, !13, !14}
!13 = !MDBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
!14 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !20, scope: !2, baseType: null)
!15 = !MDLocation(line: 4, scope: !10, inlinedAt: !8)
!16 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 4, arg: 0, scope: !10, file: !2, type: !13, inlinedAt: !8)
!17 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "z", line: 4, arg: 0, scope: !10, file: !2, type: !14, inlinedAt: !8)
!16 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 4, arg: 0, scope: !10, file: !2, type: !13)
!17 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "z", line: 4, arg: 0, scope: !10, file: !2, type: !14)
!18 = !MDLocation(line: 5, scope: !10, inlinedAt: !8)
!19 = !MDLocation(line: 10, scope: !1)
!20 = !MDFile(filename: "bar.c", directory: "/tmp/")

View File

@ -1813,11 +1813,9 @@ TEST_F(MDLocalVariableTest, get) {
MDTypeRef Type = getDerivedType();
unsigned Arg = 6;
unsigned Flags = 7;
MDLocation *InlinedAt =
MDLocation::getDistinct(Context, 10, 20, getSubprogram());
auto *N = MDLocalVariable::get(Context, Tag, Scope, Name, File, Line, Type,
Arg, Flags, InlinedAt);
Arg, Flags);
EXPECT_EQ(Tag, N->getTag());
EXPECT_EQ(Scope, N->getScope());
EXPECT_EQ(Name, N->getName());
@ -1826,46 +1824,28 @@ TEST_F(MDLocalVariableTest, get) {
EXPECT_EQ(Type, N->getType());
EXPECT_EQ(Arg, N->getArg());
EXPECT_EQ(Flags, N->getFlags());
EXPECT_EQ(InlinedAt, N->getInlinedAt());
EXPECT_EQ(N, MDLocalVariable::get(Context, Tag, Scope, Name, File, Line, Type,
Arg, Flags, InlinedAt));
Arg, Flags));
EXPECT_NE(N, MDLocalVariable::get(Context, dwarf::DW_TAG_auto_variable, Scope,
Name, File, Line, Type, Arg, Flags,
InlinedAt));
Name, File, Line, Type, Arg, Flags));
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, getSubprogram(), Name, File,
Line, Type, Arg, Flags, InlinedAt));
Line, Type, Arg, Flags));
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, Scope, "other", File, Line,
Type, Arg, Flags, InlinedAt));
Type, Arg, Flags));
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, Scope, Name, getFile(), Line,
Type, Arg, Flags, InlinedAt));
Type, Arg, Flags));
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, Scope, Name, File, Line + 1,
Type, Arg, Flags, InlinedAt));
Type, Arg, Flags));
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, Scope, Name, File, Line,
getDerivedType(), Arg, Flags, InlinedAt));
getDerivedType(), Arg, Flags));
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, Scope, Name, File, Line, Type,
Arg + 1, Flags, InlinedAt));
Arg + 1, Flags));
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, Scope, Name, File, Line, Type,
Arg, ~Flags, InlinedAt));
EXPECT_NE(N, MDLocalVariable::get(
Context, Tag, Scope, Name, File, Line, Type, Arg, Flags,
MDLocation::getDistinct(Context, 10, 20, getSubprogram())));
Arg, ~Flags));
TempMDLocalVariable Temp = N->clone();
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
auto *Inlined = N->withoutInline();
EXPECT_NE(N, Inlined);
EXPECT_EQ(N->getTag(), Inlined->getTag());
EXPECT_EQ(N->getScope(), Inlined->getScope());
EXPECT_EQ(N->getName(), Inlined->getName());
EXPECT_EQ(N->getFile(), Inlined->getFile());
EXPECT_EQ(N->getLine(), Inlined->getLine());
EXPECT_EQ(N->getType(), Inlined->getType());
EXPECT_EQ(N->getArg(), Inlined->getArg());
EXPECT_EQ(N->getFlags(), Inlined->getFlags());
EXPECT_EQ(nullptr, Inlined->getInlinedAt());
EXPECT_EQ(N, Inlined->withInline(cast<MDLocation>(InlinedAt)));
}
typedef MetadataTest MDExpressionTest;