Skip to content

Commit c3f8c34

Browse files
authored
[mlir][debug] Inherit DISubprogramAttr from DILocalScopeAttr. (#156081)
As mentioned in #154926, `DISubprogramAttr` is inherited from `DIScopeAttr` while in llvm, the `DISubprogram` inherits from `DILocalScope`. This change corrects the hierarchy. Also does the same change for `DILexicalBlockAttr` and `DILexicalBlockFileAttr`.
1 parent 7370405 commit c3f8c34

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ def LLVM_DIGlobalVariable : LLVM_Attr<"DIGlobalVariable", "di_global_variable",
590590
//===----------------------------------------------------------------------===//
591591

592592
def LLVM_DILexicalBlockAttr : LLVM_Attr<"DILexicalBlock", "di_lexical_block",
593-
/*traits=*/[], "DIScopeAttr"> {
593+
/*traits=*/[], "DILocalScopeAttr"> {
594594
let parameters = (ins
595595
"DIScopeAttr":$scope,
596596
OptionalParameter<"DIFileAttr">:$file,
@@ -616,7 +616,7 @@ def LLVM_DILexicalBlockAttr : LLVM_Attr<"DILexicalBlock", "di_lexical_block",
616616
//===----------------------------------------------------------------------===//
617617

618618
def LLVM_DILexicalBlockFile : LLVM_Attr<"DILexicalBlockFile", "di_lexical_block_file",
619-
/*traits=*/[], "DIScopeAttr"> {
619+
/*traits=*/[], "DILocalScopeAttr"> {
620620
let parameters = (ins
621621
"DIScopeAttr":$scope,
622622
OptionalParameter<"DIFileAttr">:$file,
@@ -674,7 +674,7 @@ def LLVM_DILocalVariableAttr : LLVM_Attr<"DILocalVariable", "di_local_variable",
674674

675675
def LLVM_DISubprogramAttr : LLVM_Attr<"DISubprogram", "di_subprogram",
676676
[LLVM_DIRecursiveTypeAttrInterface],
677-
"DIScopeAttr"> {
677+
"DILocalScopeAttr"> {
678678
let parameters = (ins
679679
// DIRecursiveTypeAttrInterface specific parameters.
680680
OptionalParameter<"DistinctAttr">:$recId,

mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ static void convertModuleFlagsOp(ArrayAttr flags, llvm::IRBuilderBase &builder,
362362
static llvm::DILocalScope *
363363
getLocalScopeFromLoc(llvm::IRBuilderBase &builder, Location loc,
364364
LLVM::ModuleTranslation &moduleTranslation) {
365-
if (auto scopeLoc = loc->findInstanceOf<FusedLocWith<LLVM::DIScopeAttr>>())
365+
if (auto scopeLoc =
366+
loc->findInstanceOf<FusedLocWith<LLVM::DILocalScopeAttr>>())
366367
if (auto *localScope = llvm::dyn_cast<llvm::DILocalScope>(
367368
moduleTranslation.translateDebugInfo(scopeLoc.getMetadata())))
368369
return localScope;

0 commit comments

Comments
 (0)