Skip to content

Commit ed013cd

Browse files
committed
DI: Remove DW_TAG_arg_variable and DW_TAG_auto_variable
Remove the fake `DW_TAG_auto_variable` and `DW_TAG_arg_variable` tags, using `DW_TAG_variable` in their place Stop exposing the `tag:` field at all in the assembly format for `DILocalVariable`. Most of the testcase updates were generated by the following sed script: find test/ -name "*.ll" -o -name "*.mir" | xargs grep -l 'DILocalVariable' | xargs sed -i '' \ -e 's/tag: DW_TAG_arg_variable, //' \ -e 's/tag: DW_TAG_auto_variable, //' There were only a handful of tests in `test/Assembly` that I needed to update by hand. (Note: a follow-up could change `DILocalVariable::DILocalVariable()` to set the tag to `DW_TAG_formal_parameter` instead of `DW_TAG_variable` (as appropriate), instead of having that logic magically in the backend in `DbgVariable`. I've added a FIXME to that effect.) llvm-svn: 243774
1 parent 0aeed7c commit ed013cd

File tree

297 files changed

+1103
-1114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

297 files changed

+1103
-1114
lines changed

llvm/docs/LangRef.rst

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3900,22 +3900,18 @@ mandatory, and points at an :ref:`DILexicalBlockFile`, an
39003900
DILocalVariable
39013901
"""""""""""""""
39023902

3903-
``DILocalVariable`` nodes represent local variables in the source language.
3904-
Instead of ``DW_TAG_variable``, they use LLVM-specific fake tags to
3905-
discriminate between local variables (``DW_TAG_auto_variable``) and subprogram
3906-
arguments (``DW_TAG_arg_variable``). In the latter case, the ``arg:`` field
3907-
specifies the argument position, and this variable will be included in the
3908-
``variables:`` field of its :ref:`DISubprogram`.
3909-
3910-
.. code-block:: llvm
3911-
3912-
!0 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1,
3913-
scope: !3, file: !2, line: 7, type: !3,
3914-
flags: DIFlagArtificial)
3915-
!1 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 2,
3916-
scope: !4, file: !2, line: 7, type: !3)
3917-
!2 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "y",
3918-
scope: !5, file: !2, line: 7, type: !3)
3903+
``DILocalVariable`` nodes represent local variables in the source language. If
3904+
the ``arg:`` field is set to non-zero, then this variable is a subprogram
3905+
parameter, and it will be included in the ``variables:`` field of its
3906+
:ref:`DISubprogram`.
3907+
3908+
.. code-block:: llvm
3909+
3910+
!0 = !DILocalVariable(name: "this", arg: 1, scope: !3, file: !2, line: 7,
3911+
type: !3, flags: DIFlagArtificial)
3912+
!1 = !DILocalVariable(name: "x", arg: 2, scope: !4, file: !2, line: 7,
3913+
type: !3)
3914+
!2 = !DILocalVariable(name: "y", scope: !5, file: !2, line: 7, type: !3)
39193915
39203916
DIExpression
39213917
""""""""""""

llvm/docs/SourceLevelDebugging.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,13 @@ Compiled to LLVM, this function would be represented like this:
270270
!8 = !{i32 2, !"Debug Info Version", i32 3}
271271
!9 = !{i32 1, !"PIC Level", i32 2}
272272
!10 = !{!"clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)"}
273-
!11 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "X", scope: !4, file: !1, line: 2, type: !12)
273+
!11 = !DILocalVariable(name: "X", scope: !4, file: !1, line: 2, type: !12)
274274
!12 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
275275
!13 = !DIExpression()
276276
!14 = !DILocation(line: 2, column: 9, scope: !4)
277-
!15 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "Y", scope: !4, file: !1, line: 3, type: !12)
277+
!15 = !DILocalVariable(name: "Y", scope: !4, file: !1, line: 3, type: !12)
278278
!16 = !DILocation(line: 3, column: 9, scope: !4)
279-
!17 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "Z", scope: !18, file: !1, line: 5, type: !12)
279+
!17 = !DILocalVariable(name: "Z", scope: !18, file: !1, line: 5, type: !12)
280280
!18 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 5)
281281
!19 = !DILocation(line: 5, column: 11, scope: !18)
282282
!20 = !DILocation(line: 6, column: 11, scope: !18)

llvm/include/llvm/IR/DebugInfoMetadata.h

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,15 +1750,13 @@ class DITemplateValueParameter : public DITemplateParameter {
17501750
};
17511751

17521752
/// \brief Base class for variables.
1753-
///
1754-
/// TODO: Hardcode to DW_TAG_variable.
17551753
class DIVariable : public DINode {
17561754
unsigned Line;
17571755

17581756
protected:
1759-
DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
1760-
unsigned Line, ArrayRef<Metadata *> Ops)
1761-
: DINode(C, ID, Storage, Tag, Ops), Line(Line) {}
1757+
DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Line,
1758+
ArrayRef<Metadata *> Ops)
1759+
: DINode(C, ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line) {}
17621760
~DIVariable() = default;
17631761

17641762
public:
@@ -1803,8 +1801,7 @@ class DIGlobalVariable : public DIVariable {
18031801
DIGlobalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
18041802
bool IsLocalToUnit, bool IsDefinition,
18051803
ArrayRef<Metadata *> Ops)
1806-
: DIVariable(C, DIGlobalVariableKind, Storage, dwarf::DW_TAG_variable,
1807-
Line, Ops),
1804+
: DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops),
18081805
IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
18091806
~DIGlobalVariable() = default;
18101807

@@ -1876,8 +1873,6 @@ class DIGlobalVariable : public DIVariable {
18761873

18771874
/// \brief Local variable.
18781875
///
1879-
/// TODO: Split between arguments and otherwise.
1880-
/// TODO: Use \c DW_TAG_variable instead of fake tags.
18811876
/// TODO: Split up flags.
18821877
class DILocalVariable : public DIVariable {
18831878
friend class LLVMContextImpl;
@@ -1886,42 +1881,42 @@ class DILocalVariable : public DIVariable {
18861881
unsigned Arg;
18871882
unsigned Flags;
18881883

1889-
DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Tag,
1890-
unsigned Line, unsigned Arg, unsigned Flags,
1891-
ArrayRef<Metadata *> Ops)
1892-
: DIVariable(C, DILocalVariableKind, Storage, Tag, Line, Ops), Arg(Arg),
1884+
DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
1885+
unsigned Arg, unsigned Flags, ArrayRef<Metadata *> Ops)
1886+
: DIVariable(C, DILocalVariableKind, Storage, Line, Ops), Arg(Arg),
18931887
Flags(Flags) {}
18941888
~DILocalVariable() = default;
18951889

1896-
static DILocalVariable *getImpl(LLVMContext &Context, unsigned Tag,
1897-
DIScope *Scope, StringRef Name, DIFile *File,
1898-
unsigned Line, DITypeRef Type, unsigned Arg,
1899-
unsigned Flags, StorageType Storage,
1890+
static DILocalVariable *getImpl(LLVMContext &Context, DIScope *Scope,
1891+
StringRef Name, DIFile *File, unsigned Line,
1892+
DITypeRef Type, unsigned Arg, unsigned Flags,
1893+
StorageType Storage,
19001894
bool ShouldCreate = true) {
1901-
return getImpl(Context, Tag, Scope, getCanonicalMDString(Context, Name),
1902-
File, Line, Type, Arg, Flags, Storage, ShouldCreate);
1895+
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
1896+
Line, Type, Arg, Flags, Storage, ShouldCreate);
19031897
}
1904-
static DILocalVariable *
1905-
getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name,
1906-
Metadata *File, unsigned Line, Metadata *Type, unsigned Arg,
1907-
unsigned Flags, StorageType Storage, bool ShouldCreate = true);
1898+
static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
1899+
MDString *Name, Metadata *File, unsigned Line,
1900+
Metadata *Type, unsigned Arg, unsigned Flags,
1901+
StorageType Storage,
1902+
bool ShouldCreate = true);
19081903

19091904
TempDILocalVariable cloneImpl() const {
1910-
return getTemporary(getContext(), getTag(), getScope(), getName(),
1911-
getFile(), getLine(), getType(), getArg(), getFlags());
1905+
return getTemporary(getContext(), getScope(), getName(), getFile(),
1906+
getLine(), getType(), getArg(), getFlags());
19121907
}
19131908

19141909
public:
19151910
DEFINE_MDNODE_GET(DILocalVariable,
1916-
(unsigned Tag, DILocalScope *Scope, StringRef Name,
1917-
DIFile *File, unsigned Line, DITypeRef Type, unsigned Arg,
1911+
(DILocalScope * Scope, StringRef Name, DIFile *File,
1912+
unsigned Line, DITypeRef Type, unsigned Arg,
19181913
unsigned Flags),
1919-
(Tag, Scope, Name, File, Line, Type, Arg, Flags))
1914+
(Scope, Name, File, Line, Type, Arg, Flags))
19201915
DEFINE_MDNODE_GET(DILocalVariable,
1921-
(unsigned Tag, Metadata *Scope, MDString *Name,
1922-
Metadata *File, unsigned Line, Metadata *Type,
1923-
unsigned Arg, unsigned Flags),
1924-
(Tag, Scope, Name, File, Line, Type, Arg, Flags))
1916+
(Metadata * Scope, MDString *Name, Metadata *File,
1917+
unsigned Line, Metadata *Type, unsigned Arg,
1918+
unsigned Flags),
1919+
(Scope, Name, File, Line, Type, Arg, Flags))
19251920

19261921
TempDILocalVariable clone() const { return cloneImpl(); }
19271922

@@ -1932,6 +1927,7 @@ class DILocalVariable : public DIVariable {
19321927
return cast<DILocalScope>(DIVariable::getScope());
19331928
}
19341929

1930+
bool isParameter() const { return Arg; }
19351931
unsigned getArg() const { return Arg; }
19361932
unsigned getFlags() const { return Flags; }
19371933

llvm/include/llvm/Support/Dwarf.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ HANDLE_DW_TAG(0x0041, type_unit)
9999
HANDLE_DW_TAG(0x0042, rvalue_reference_type)
100100
HANDLE_DW_TAG(0x0043, template_alias)
101101

102-
// Mock tags we use as discriminators.
103-
HANDLE_DW_TAG(0x0100, auto_variable) // Tag for local (auto) variables.
104-
HANDLE_DW_TAG(0x0101, arg_variable) // Tag for argument variables.
105-
106102
// New in DWARF v5.
107103
HANDLE_DW_TAG(0x0044, coarray_type)
108104
HANDLE_DW_TAG(0x0045, generic_subrange)

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3773,24 +3773,25 @@ bool LLParser::ParseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
37733773
}
37743774

37753775
/// ParseDILocalVariable:
3776-
/// ::= !DILocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo",
3776+
/// ::= !DILocalVariable(arg: 7, scope: !0, name: "foo",
3777+
/// file: !1, line: 7, type: !2, arg: 2, flags: 7)
3778+
/// ::= !DILocalVariable(scope: !0, name: "foo",
37773779
/// file: !1, line: 7, type: !2, arg: 2, flags: 7)
37783780
bool LLParser::ParseDILocalVariable(MDNode *&Result, bool IsDistinct) {
37793781
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
3780-
REQUIRED(tag, DwarfTagField, ); \
37813782
REQUIRED(scope, MDField, (/* AllowNull */ false)); \
37823783
OPTIONAL(name, MDStringField, ); \
3784+
OPTIONAL(arg, MDUnsignedField, (0, UINT16_MAX)); \
37833785
OPTIONAL(file, MDField, ); \
37843786
OPTIONAL(line, LineField, ); \
37853787
OPTIONAL(type, MDField, ); \
3786-
OPTIONAL(arg, MDUnsignedField, (0, UINT16_MAX)); \
37873788
OPTIONAL(flags, DIFlagField, );
37883789
PARSE_MD_FIELDS();
37893790
#undef VISIT_MD_FIELDS
37903791

37913792
Result = GET_OR_DISTINCT(DILocalVariable,
3792-
(Context, tag.Val, scope.Val, name.Val, file.Val,
3793-
line.Val, type.Val, arg.Val, flags.Val));
3793+
(Context, scope.Val, name.Val, file.Val, line.Val,
3794+
type.Val, arg.Val, flags.Val));
37943795
return false;
37953796
}
37963797

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,15 +1972,19 @@ std::error_code BitcodeReader::parseMetadata() {
19721972
}
19731973
case bitc::METADATA_LOCAL_VAR: {
19741974
// 10th field is for the obseleted 'inlinedAt:' field.
1975-
if (Record.size() != 9 && Record.size() != 10)
1975+
if (Record.size() < 8 || Record.size() > 10)
19761976
return error("Invalid record");
19771977

1978+
// 2nd field used to be an artificial tag, either DW_TAG_auto_variable or
1979+
// DW_TAG_arg_variable.
1980+
bool HasTag = Record.size() > 8;
19781981
MDValueList.assignValue(
19791982
GET_OR_DISTINCT(DILocalVariable, Record[0],
1980-
(Context, Record[1], getMDOrNull(Record[2]),
1981-
getMDString(Record[3]), getMDOrNull(Record[4]),
1982-
Record[5], getMDOrNull(Record[6]), Record[7],
1983-
Record[8])),
1983+
(Context, getMDOrNull(Record[1 + HasTag]),
1984+
getMDString(Record[2 + HasTag]),
1985+
getMDOrNull(Record[3 + HasTag]), Record[4 + HasTag],
1986+
getMDOrNull(Record[5 + HasTag]), Record[6 + HasTag],
1987+
Record[7 + HasTag])),
19841988
NextMDValueNo++);
19851989
break;
19861990
}

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,6 @@ static void WriteDILocalVariable(const DILocalVariable *N,
11001100
SmallVectorImpl<uint64_t> &Record,
11011101
unsigned Abbrev) {
11021102
Record.push_back(N->isDistinct());
1103-
Record.push_back(N->getTag());
11041103
Record.push_back(VE.getMetadataOrNullID(N->getScope()));
11051104
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
11061105
Record.push_back(VE.getMetadataOrNullID(N->getFile()));

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
11561156
// The first mention of a function argument gets the CurrentFnBegin
11571157
// label, so arguments are visible when breaking at function entry.
11581158
const DILocalVariable *DIVar = Ranges.front().first->getDebugVariable();
1159-
if (DIVar->getTag() == dwarf::DW_TAG_arg_variable &&
1159+
if (DIVar->isParameter() &&
11601160
getDISubprogram(DIVar->getScope())->describes(MF->getFunction())) {
11611161
LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin();
11621162
if (Ranges.front().first->getDebugExpression()->isBitPiece()) {

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ class DbgVariable {
156156

157157
// Translate tag to proper Dwarf tag.
158158
dwarf::Tag getTag() const {
159-
if (Var->getTag() == dwarf::DW_TAG_arg_variable)
159+
// FIXME: Why don't we just infer this tag and store it all along?
160+
if (Var->isParameter())
160161
return dwarf::DW_TAG_formal_parameter;
161162

162163
return dwarf::DW_TAG_variable;

llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,6 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
299299
}
300300

301301
DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) {
302-
assert(Tag != dwarf::DW_TAG_auto_variable &&
303-
Tag != dwarf::DW_TAG_arg_variable);
304302
DIE &Die = Parent.addChild(DIE::get(DIEValueAllocator, (dwarf::Tag)Tag));
305303
if (N)
306304
insertDIE(N, &Die);

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4251,8 +4251,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
42514251
if (const BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
42524252
Address = BCI->getOperand(0);
42534253
// Parameters are handled specially.
4254-
bool isParameter = Variable->getTag() == dwarf::DW_TAG_arg_variable ||
4255-
isa<Argument>(Address);
4254+
bool isParameter = Variable->isParameter() || isa<Argument>(Address);
42564255

42574256
const AllocaInst *AI = dyn_cast<AllocaInst>(Address);
42584257

llvm/lib/IR/AsmWriter.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,11 +1800,8 @@ static void writeDILocalVariable(raw_ostream &Out, const DILocalVariable *N,
18001800
SlotTracker *Machine, const Module *Context) {
18011801
Out << "!DILocalVariable(";
18021802
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
1803-
Printer.printTag(N);
18041803
Printer.printString("name", N->getName());
1805-
Printer.printInt("arg", N->getArg(),
1806-
/* ShouldSkipZero */
1807-
N->getTag() == dwarf::DW_TAG_auto_variable);
1804+
Printer.printInt("arg", N->getArg());
18081805
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
18091806
Printer.printMetadata("file", N->getRawFile());
18101807
Printer.printInt("line", N->getLine());

llvm/lib/IR/DIBuilder.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,10 +613,9 @@ static DILocalVariable *createLocalVariable(
613613
// the only valid scopes)?
614614
DIScope *Context = getNonCompileUnitScope(Scope);
615615

616-
dwarf::Tag Tag = ArgNo ? dwarf::DW_TAG_arg_variable : dwarf::DW_TAG_auto_variable;
617-
auto *Node = DILocalVariable::get(
618-
VMContext, Tag, cast_or_null<DILocalScope>(Context), Name, File, LineNo,
619-
DITypeRef::get(Ty), ArgNo, Flags);
616+
auto *Node =
617+
DILocalVariable::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
618+
File, LineNo, DITypeRef::get(Ty), ArgNo, Flags);
620619
if (AlwaysPreserve) {
621620
// The optimizer may remove local variables. If there is an interest
622621
// to preserve variable info in such situation then stash it in a

llvm/lib/IR/DebugInfoMetadata.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,21 +466,21 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
466466
Ops);
467467
}
468468

469-
DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
470-
Metadata *Scope, MDString *Name,
471-
Metadata *File, unsigned Line,
472-
Metadata *Type, unsigned Arg,
473-
unsigned Flags, StorageType Storage,
469+
DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
470+
MDString *Name, Metadata *File,
471+
unsigned Line, Metadata *Type,
472+
unsigned Arg, unsigned Flags,
473+
StorageType Storage,
474474
bool ShouldCreate) {
475475
// 64K ought to be enough for any frontend.
476476
assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits");
477477

478478
assert(Scope && "Expected scope");
479479
assert(isCanonical(Name) && "Expected canonical MDString");
480-
DEFINE_GETIMPL_LOOKUP(DILocalVariable, (Tag, Scope, getString(Name), File,
481-
Line, Type, Arg, Flags));
480+
DEFINE_GETIMPL_LOOKUP(DILocalVariable,
481+
(Scope, getString(Name), File, Line, Type, Arg, Flags));
482482
Metadata *Ops[] = {Scope, Name, File, Type};
483-
DEFINE_GETIMPL_STORE(DILocalVariable, (Tag, Line, Arg, Flags), Ops);
483+
DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags), Ops);
484484
}
485485

486486
DIExpression *DIExpression::getImpl(LLVMContext &Context,

llvm/lib/IR/LLVMContextImpl.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
759759
};
760760

761761
template <> struct MDNodeKeyImpl<DILocalVariable> {
762-
unsigned Tag;
763762
Metadata *Scope;
764763
StringRef Name;
765764
Metadata *File;
@@ -768,23 +767,23 @@ template <> struct MDNodeKeyImpl<DILocalVariable> {
768767
unsigned Arg;
769768
unsigned Flags;
770769

771-
MDNodeKeyImpl(unsigned Tag, Metadata *Scope, StringRef Name, Metadata *File,
772-
unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags)
773-
: Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type),
774-
Arg(Arg), Flags(Flags) {}
770+
MDNodeKeyImpl(Metadata *Scope, StringRef Name, Metadata *File, unsigned Line,
771+
Metadata *Type, unsigned Arg, unsigned Flags)
772+
: Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg),
773+
Flags(Flags) {}
775774
MDNodeKeyImpl(const DILocalVariable *N)
776-
: Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()),
777-
File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()),
778-
Arg(N->getArg()), Flags(N->getFlags()) {}
775+
: Scope(N->getRawScope()), Name(N->getName()), File(N->getRawFile()),
776+
Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()),
777+
Flags(N->getFlags()) {}
779778

780779
bool isKeyOf(const DILocalVariable *RHS) const {
781-
return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
782-
Name == RHS->getName() && File == RHS->getRawFile() &&
783-
Line == RHS->getLine() && Type == RHS->getRawType() &&
784-
Arg == RHS->getArg() && Flags == RHS->getFlags();
780+
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
781+
File == RHS->getRawFile() && Line == RHS->getLine() &&
782+
Type == RHS->getRawType() && Arg == RHS->getArg() &&
783+
Flags == RHS->getFlags();
785784
}
786785
unsigned getHashValue() const {
787-
return hash_combine(Tag, Scope, Name, File, Line, Type, Arg, Flags);
786+
return hash_combine(Scope, Name, File, Line, Type, Arg, Flags);
788787
}
789788
};
790789

llvm/lib/IR/Verifier.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,13 +1077,9 @@ void Verifier::visitDILocalVariable(const DILocalVariable &N) {
10771077
// Checks common to all variables.
10781078
visitDIVariable(N);
10791079

1080-
Assert(N.getTag() == dwarf::DW_TAG_auto_variable ||
1081-
N.getTag() == dwarf::DW_TAG_arg_variable,
1082-
"invalid tag", &N);
1080+
Assert(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N);
10831081
Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
10841082
"local variable requires a valid scope", &N, N.getRawScope());
1085-
Assert(bool(N.getArg()) == (N.getTag() == dwarf::DW_TAG_arg_variable),
1086-
"local variable should have arg iff it's a DW_TAG_arg_variable", &N);
10871083
}
10881084

10891085
void Verifier::visitDIExpression(const DIExpression &N) {

0 commit comments

Comments
 (0)