Skip to content

Commit

Permalink
[DebugInfo] Reduce downstream delta in DIGlobalVariable
Browse files Browse the repository at this point in the history
Now that flang-compiler/flang@65d1e98 has been
merged, we can revert the changes introduced in the following commits:

flang-compiler/llvm@5c217c2
flang-compiler/llvm@e35c28b
flang-compiler/llvm@04e9699

See #2
for information.
  • Loading branch information
bryanpkc committed Jun 29, 2022
1 parent 23aa076 commit 8ad4655
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 22 deletions.
16 changes: 0 additions & 16 deletions llvm/lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4955,21 +4955,6 @@ bool LLParser::parseDITemplateValueParameter(MDNode *&Result, bool IsDistinct) {
/// isDefinition: true, templateParams: !3,
/// declaration: !4, align: 8)
bool LLParser::parseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
#ifdef ENABLE_CLASSIC_FLANG
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
OPTIONAL(name, MDStringField, (/* AllowEmpty */ true)); \
OPTIONAL(scope, MDField, ); \
OPTIONAL(linkageName, MDStringField, ); \
OPTIONAL(file, MDField, ); \
OPTIONAL(line, LineField, ); \
OPTIONAL(type, MDField, ); \
OPTIONAL(isLocal, MDBoolField, ); \
OPTIONAL(isDefinition, MDBoolField, (true)); \
OPTIONAL(templateParams, MDField, ); \
OPTIONAL(declaration, MDField, ); \
OPTIONAL(flags, DIFlagField, ); \
OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX));
#else
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
REQUIRED(name, MDStringField, (/* AllowEmpty */ false)); \
OPTIONAL(scope, MDField, ); \
Expand All @@ -4983,7 +4968,6 @@ bool LLParser::parseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
OPTIONAL(declaration, MDField, ); \
OPTIONAL(flags, DIFlagField, ); \
OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX));
#endif
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
} else {
DeclContext = GV->getScope();
// Add name and type.
if (!GV->getDisplayName().empty())
addString(*VariableDIE, dwarf::DW_AT_name, GV->getDisplayName());
addString(*VariableDIE, dwarf::DW_AT_name, GV->getDisplayName());
if (GTy)
addType(*VariableDIE, GTy);

Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,6 @@ void Verifier::visitDIGlobalVariable(const DIGlobalVariable &N) {
visitDIVariable(N);

AssertDI(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N);
AssertDI(!N.getName().empty() || N.isArtificial(),
"missing global variable name", &N);
AssertDI(isType(N.getRawType()), "invalid type ref", &N, N.getRawType());
// Assert only if the global variable is not an extern
if (N.isDefinition())
Expand Down
1 change: 0 additions & 1 deletion llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
; UNSUPPORTED: classic_flang

; CHECK: <stdin>:[[@LINE+1]]:30: error: 'name' cannot be empty
!0 = !DIGlobalVariable(name: "")
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
; UNSUPPORTED: classic_flang

; CHECK: <stdin>:[[@LINE+1]]:24: error: missing required field 'name'
!0 = !DIGlobalVariable()

0 comments on commit 8ad4655

Please sign in to comment.