diff options
author | Orlando Cazalet-Hyams <orlando.hyams@sony.com> | 2024-02-13 11:35:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 11:35:28 +0000 |
commit | 97088b2ab2184ad4bd64f59fba0b92b70468b10d (patch) | |
tree | 75d09ca0379a585dbbfef1ce92f94923270ec3d4 | |
parent | e79ad7bb94611666a23764459098574bc0394d56 (diff) | |
download | llvm-97088b2ab2184ad4bd64f59fba0b92b70468b10d.zip llvm-97088b2ab2184ad4bd64f59fba0b92b70468b10d.tar.gz llvm-97088b2ab2184ad4bd64f59fba0b92b70468b10d.tar.bz2 |
[RemoveDIs][ValueMapper] Remap DIAssignIDs in DPValues (#81595)
Fix crash raised in comments for 5c9f7682b090124d9a8b69f92d3f7c269dca25fc
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 1 | ||||
-rw-r--r-- | llvm/test/DebugInfo/Generic/ipsccp-remap-assign-id.ll | 59 |
2 files changed, 60 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index a8ae3ee..93a4c82 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -552,6 +552,7 @@ void Mapper::remapDPValue(DPValue &V) { V.setKillAddress(); else if (NewAddr) V.setAddress(NewAddr); + V.setAssignId(cast<DIAssignID>(mapMetadata(V.getAssignID()))); } // Find Value operands and remap those. diff --git a/llvm/test/DebugInfo/Generic/ipsccp-remap-assign-id.ll b/llvm/test/DebugInfo/Generic/ipsccp-remap-assign-id.ll new file mode 100644 index 0000000..13ac88d --- /dev/null +++ b/llvm/test/DebugInfo/Generic/ipsccp-remap-assign-id.ll @@ -0,0 +1,59 @@ +; RUN: opt -passes=ipsccp %s -S -o - | FileCheck %s +; RUN: opt --try-experimental-debuginfo-iterators -passes=ipsccp %s -S -o - | FileCheck %s + +;; Check the dbg.assign DIAssignID operand gets remapped after cloning. + +; CHECK: %tmp = alloca [4096 x i32], i32 0, align 16, !DIAssignID ![[ID1:[0-9]+]] +; CHECK-NEXT: dbg.assign(metadata i1 undef, metadata !{{.*}}, metadata !DIExpression(), metadata ![[ID1]], metadata ptr %tmp, metadata !DIExpression()) +; +; CHECK: %tmp = alloca [4096 x i32], i32 0, align 16, !DIAssignID ![[ID2:[0-9]+]] +; CHECK-NEXT: dbg.assign(metadata i1 undef, metadata !{{.*}}, metadata !DIExpression(), metadata ![[ID2]], metadata ptr %tmp, metadata !DIExpression()) + +; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) +declare void @llvm.dbg.declare(metadata, metadata, metadata) + +define void @inv_txfm_add_dct_dct_4x4_c() { +entry: + call void @inv_txfm_add_c(ptr @dav1d_inv_dct4_1d_c) + ret void +} + +declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) + +; Function Attrs: noinline +define void @inv_txfm_add_c(ptr %first_1d_fn) #2 { +entry: + %tmp = alloca [4096 x i32], i32 0, align 16, !DIAssignID !5 + tail call void @llvm.dbg.assign(metadata i1 undef, metadata !6, metadata !DIExpression(), metadata !5, metadata ptr %tmp, metadata !DIExpression()), !dbg !16 + call void @llvm.memset.p0.i64(ptr %tmp, i8 0, i64 0, i1 false), !DIAssignID !17 + call void %first_1d_fn(ptr null, i64 0, i32 0, i32 0) + ret void +} + +declare void @dav1d_inv_dct4_1d_c(ptr, i64, i32, i32) + +declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) + +attributes #2 = { noinline } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4} + +!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, splitDebugInlining: false, nameTableKind: GNU) +!1 = !DIFile(filename: "itx_tmpl.c", directory: ".") +!2 = !{} +!3 = !{i32 2, !"Debug Info Version", i32 3} +!4 = !{i32 7, !"debug-info-assignment-tracking", i1 true} +!5 = distinct !DIAssignID() +!6 = !DILocalVariable(name: "tmp", scope: !7, file: !1, line: 78, type: !10) +!7 = distinct !DISubprogram(name: "inv_txfm_add_c", scope: !1, file: !1, line: 41, type: !8, scopeLine: 45, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) +!8 = distinct !DISubroutineType(types: !9) +!9 = !{null} +!10 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 131072, elements: !2) +!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "int32_t", file: !12, line: 26, baseType: !13) +!12 = !DIFile(filename: "stdint-intn.h", directory: ".") +!13 = !DIDerivedType(tag: DW_TAG_typedef, name: "__int32_t", file: !14, line: 41, baseType: !15) +!14 = !DIFile(filename: "types.h", directory: ".") +!15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!16 = !DILocation(line: 0, scope: !7) +!17 = distinct !DIAssignID() |