[llvm] [DebugInfo] Add Verifier check for incorrectly-scoped retainedNodes (PR #166855)
Vladislav Dzhidzhoev via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 11 13:35:29 PST 2025
dzhidzhoev wrote:
> This change triggered a failure for RISCV. Reproducer is attached:
>
> https://drive.google.com/file/d/1BcCsWJZ1tOBO9ZWdUBFnFM3tKz74uZNj/view?usp=sharing
I think the problem occurs before LTO stage, when `frameworks/av/services/camera/libcameraservice/device3/Camera3Device.cpp` is compiled, because `Camera3Device.o` in `usr/local/google/home/yikong/android/aosp/out/soong/.intermediates/frameworks/av/services/camera/libcameraservice/libcameraservice/android_riscv64_static_cfi/libcameraservice.a` already fails the check:
```
(llvm) vlad ~/Downloads/repro2 llvm-ar -x usr/local/google/home/yikong/android/aosp/out/soong/.intermediates/frameworks/av/services/camera/libcameraservice/libcameraservice/android_riscv64_static_cfi/libcameraservice.a --output usr/local/google/home/yikong/android/aosp/out/soong/.intermediates/frameworks/av/services/camera/libcameraservice/libcameraservice/android_riscv64_static_cfi/
(llvm) vlad ~/Downloads/repro2 opt --passes=verify usr/local/google/home/yikong/android/aosp/out/soong/.intermediates/frameworks/av/services/camera/libcameraservice/libcameraservice/android_riscv64_static_cfi/Camera3Device.o
invalid retained nodes, retained node does not belong to subprogram
!71313 = distinct !DISubprogram(name: "setErrorState", linkageName: "_ZN7android13Camera3Device13setErrorStateEPKcz", scope: !297, file: !3, line: 2847, type: !25368, scopeLine: 2847, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !25367, retainedNodes: !71025, keyInstructions: true)
!3 = !DIFile(filename: "frameworks/av/services/camera/libcameraservice/device3/Camera3Device.cpp", directory: "", checksumkind: CSK_MD5, checksum: "a1faf30d5a8be1d367dfa2c5f5f6bf88")
!71025 = !{!71026, !71027, !71028, !71029, !71030}
!71026 = !DILocalVariable(name: "this", arg: 1, scope: !71024, type: !11274, flags: DIFlagArtificial | DIFlagObjectPointer)
!71024 = distinct !DISubprogram(name: "setErrorState", linkageName: "_ZN7android13Camera3Device13setErrorStateEPKcz", scope: !297, file: !3, line: 2847, type: !25368, scopeLine: 2847, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !25367, retainedNodes: !71025, keyInstructions: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 22.0.0git (git at github.com:llvm/llvm-project.git e2a2c03eefc0f0d2844065949591acb5bafc69b3)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !26549, globals: !38368, imports: !39808, splitDebugInlining: false, nameTableKind: None)
!3 = !DIFile(filename: "frameworks/av/services/camera/libcameraservice/device3/Camera3Device.cpp", directory: "", checksumkind: CSK_MD5, checksum: "a1faf30d5a8be1d367dfa2c5f5f6bf88")
invalid retained nodes, retained node does not belong to subprogram
!71422 = distinct !DISubprogram(name: "setErrorStateLocked", linkageName: "_ZN7android13Camera3Device19setErrorStateLockedEPKcz", scope: !297, file: !3, line: 2864, type: !25368, scopeLine: 2864, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !25370, retainedNodes: !71409, keyInstructions: true)
!3 = !DIFile(filename: "frameworks/av/services/camera/libcameraservice/device3/Camera3Device.cpp", directory: "", checksumkind: CSK_MD5, checksum: "a1faf30d5a8be1d367dfa2c5f5f6bf88")
!71409 = !{!71410, !71411, !71412}
!71410 = !DILocalVariable(name: "this", arg: 1, scope: !71408, type: !11274, flags: DIFlagArtificial | DIFlagObjectPointer)
!71408 = distinct !DISubprogram(name: "setErrorStateLocked", linkageName: "_ZN7android13Camera3Device19setErrorStateLockedEPKcz", scope: !297, file: !3, line: 2864, type: !25368, scopeLine: 2864, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !25370, retainedNodes: !71409, keyInstructions: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 22.0.0git (git at github.com:llvm/llvm-project.git e2a2c03eefc0f0d2844065949591acb5bafc69b3)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !26549, globals: !38368, imports: !39808, splitDebugInlining: false, nameTableKind: None)
!3 = !DIFile(filename: "frameworks/av/services/camera/libcameraservice/device3/Camera3Device.cpp", directory: "", checksumkind: CSK_MD5, checksum: "a1faf30d5a8be1d367dfa2c5f5f6bf88")
warning: ignoring invalid debug info in usr/local/google/home/yikong/android/aosp/out/soong/.intermediates/frameworks/av/services/camera/libcameraservice/libcameraservice/android_riscv64_static_cfi/Camera3Device.o
WARNING: You're attempting to print out a bitcode file.
This is inadvisable as it may cause display problems. If
you REALLY want to taste LLVM bitcode first-hand, you
can force output with the `-f' option.
```
Could you please check whether it is a clang frontend issue, or LLVM backend issue? And provide the corresponding C++ or LLVM IR reproducer.
https://github.com/llvm/llvm-project/pull/166855
More information about the llvm-commits
mailing list