Skip to content

[OpenMP] New OMPIRBuilder reduction handling does not properly preserve debug metadata. #97458

Closed
@jhuber6

Description

@jhuber6

The changes in #80343 cause the offloading/bug51781.c test to fail when compiled with debugging symbols present.

> clang ../offload/test/offloading/bug51781.c -fopenmp -O1 --offload-arch=sm_89 -DADD_REDUCTION --offload-device-only -gline-tables-only
!dbg attachment points at wrong subprogram for function
!19 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
ptr @__omp_offloading_10302_af88b66_main_l44
  %16 = load i32, ptr %14, align 4, !dbg !50, !tbaa !35
!50 = !DILocation(line: 44, column: 58, scope: !32)
!32 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44_omp_outlined", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
!32 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44_omp_outlined", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
!dbg attachment points at wrong subprogram for function
!19 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
ptr @__omp_offloading_10302_af88b66_main_l44
  %14 = load i32, ptr %12, align 4, !dbg !50, !tbaa !35
!50 = !DILocation(line: 44, column: 58, scope: !32)
!32 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44_omp_outlined", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
!32 = distinct !DISubprogram(name: "__omp_offloading_10302_af88b66_main_l44_omp_outlined", scope: !11, file: !11, line: 44, type: !20, scopeLine: 44, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !10)
clang-19: /home/jhuber/Documents/llvm/llvm-project/llvm/lib/CodeGen/LexicalScopes.cpp:178: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(const llvm::DILocalScope*): Assertion `cast<DISubprogram>(Scope)->describes(&MF->getFunction())' failed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions