[Mlir-commits] [flang] [mlir] [mlir][debug] Handle DIImportedEntity. (PR #103055)

Johannes de Fine Licht llvmlistbot at llvm.org
Thu Aug 29 00:49:34 PDT 2024


definelicht wrote:

@abidh We're are experiencing a crash in the cyclic import cache (cc @zyx-billy) after this change.
```
mlir-translate: llvm-project/mlir/include/mlir/Support/CyclicReplacerCache.h:191: typename CyclicReplacerCache<InT, OutT>::CacheEntry mlir::CyclicReplacerCache<llvm::DINode *, mlir::LLVM::DINodeAttr>::lookupOrInit(InT) [InT = llvm::DINode *, OutT = mlir::LLVM::DINodeAttr]: Assertion `it->second.size() <= 2 && "illegal 3rd repeat of input"' failed.
```
I'm unsure if this warrants a revert, since this might be a bug uncovered in the caching code? (cc @Dinistro and @gysit). Attaching a reproducer below:

```
; ModuleID = 'reproducer.ll'
source_filename = "reproducer.ll"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @foo() !dbg !23 {
  ret void
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!22}

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !3, imports: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "/my/dir/foo.cpp", directory: "/my/dir")
!2 = !{}
!3 = !{!4, !11, !17}
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
!5 = distinct !DIGlobalVariable(name: "foo", scope: !0, file: !6, line: 110, type: !7, isLocal: false, isDefinition: true)
!6 = !DIFile(filename: "dir/foo.cpp", directory: "dir")
!7 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "unordered_map<unsigned int, std::__1::thread, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<const unsigned int, std::__1::thread> > >", scope: !9, file: !8, line: 1103, size: 320, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !2, templateParams: !2, identifier: "_ZTSNSt3__113unordered_mapIjNS_6threadENS_4hashIjEENS_8equal_toIjEENS_9allocatorINS_4pairIKjS1_EEEEEE")
!8 = !DIFile(filename: "include/c++/v1/unordered_map", directory: "/usr/")
!9 = !DINamespace(name: "__1", scope: !10, exportSymbols: true)
!10 = !DINamespace(name: "std", scope: null)
!11 = !DIGlobalVariableExpression(var: !12, expr: !DIExpression())
!12 = distinct !DIGlobalVariable(scope: null, file: !13, line: 252, type: !14, isLocal: true, isDefinition: true)
!13 = !DIFile(filename: "include/c++/v1/__thread/thread.h", directory: "/usr/")
!14 = !DICompositeType(tag: DW_TAG_array_type, baseType: !15, size: 208, elements: !2)
!15 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !16)
!16 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression())
!18 = distinct !DIGlobalVariable(name: "piecewise_construct", linkageName: "_ZNSt3__119piecewise_constructE", scope: !9, file: !19, line: 23, type: !20, isLocal: false, isDefinition: true)
!19 = !DIFile(filename: "include/c++/v1/__utility/piecewise_construct.h", directory: "/usr/")
!20 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !21)
!21 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "piecewise_construct_t", scope: !9, file: !19, line: 20, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: "_ZTSNSt3__121piecewise_construct_tE")
!22 = !{i32 2, !"Debug Info Version", i32 3}
!23 = distinct !DISubprogram(name: "foo", scope: !6, file: !6, line: 97, type: !24, scopeLine: 98, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !26)
!24 = distinct !DISubroutineType(types: !25)
!25 = !{null}
!26 = !{!27}
!27 = !DILocalVariable(name: "foo", arg: 1, scope: !23, file: !6, line: 97, type: !28)
!28 = !DIDerivedType(tag: DW_TAG_typedef, name: "foo_t", file: !29, line: 14, baseType: !30)
!29 = !DIFile(filename: "dir/foo.h", directory: "dir")
!30 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint32_t", file: !31, line: 26, baseType: !32)
!31 = !DIFile(filename: "include/bits/stdint-uintn.h", directory: "/usr/")
!32 = !DIDerivedType(tag: DW_TAG_typedef, name: "__uint32_t", file: !33, line: 42, baseType: !34)
!33 = !DIFile(filename: "include/bits/types.h", directory: "/usr/")
!34 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
```

https://github.com/llvm/llvm-project/pull/103055


More information about the Mlir-commits mailing list