xref: /llvm-project/llvm/test/Transforms/Util/salvage-debuginfo.ll (revision 094572701dce4aaf36f4521d6cf750420d39f206)
1; RUN: opt -passes=adce %s -S -o - | FileCheck %s
2; RUN: opt -passes=bdce %s -S -o - | FileCheck %s
3; RUN: opt -passes=adce %s -S -o - --try-experimental-debuginfo-iterators | FileCheck %s
4; RUN: opt -passes=bdce %s -S -o - --try-experimental-debuginfo-iterators | FileCheck %s
5target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-apple-macosx"
7define void @f(i32) !dbg !8 {
8entry:
9  %p_x = inttoptr i32 %0 to ptr
10  %i_x = ptrtoint ptr %p_x to i32
11  ; CHECK: #dbg_value(i32 %0,
12  ; CHECK-SAME: !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_unsigned,
13  ; CHECK-SAME:               DW_OP_LLVM_convert, 64, DW_ATE_unsigned,
14  ; CHECK-SAME:               DW_OP_LLVM_convert, 64, DW_ATE_unsigned,
15  ; CHECK-SAME:               DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_stack_value)
16  call void @llvm.dbg.value(metadata i32 %i_x, metadata !11, metadata !DIExpression()), !dbg !13
17  ret void, !dbg !13
18}
19declare void @llvm.dbg.value(metadata, metadata, metadata)
20
21!llvm.dbg.cu = !{!0}
22!llvm.module.flags = !{!3, !4}
23!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug)
24!1 = !DIFile(filename: "salavage.c", directory: "/")
25!3 = !{i32 2, !"Dwarf Version", i32 4}
26!4 = !{i32 2, !"Debug Info Version", i32 3}
27!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0)
28!9 = !DISubroutineType(types: !10)
29!10 = !{null}
30!11 = !DILocalVariable(name: "x", scope: !8, file: !1, line: 2, type: !12)
31!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
32!13 = !DILocation(line: 1, column: 1, scope: !8)
33