xref: /llvm-project/llvm/test/Transforms/EarlyCSE/debug-info-undef.ll (revision 094572701dce4aaf36f4521d6cf750420d39f206)
1; RUN: opt -S %s -passes=early-cse -earlycse-debug-hash | FileCheck %s
2
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4
5@a = global i8 25, align 1, !dbg !0
6
7define signext i16 @b() !dbg !12 {
8entry:
9  call void @llvm.dbg.value(metadata i16 23680, metadata !17, metadata !DIExpression()), !dbg !18
10  %0 = load i8, ptr @a, align 1, !dbg !19, !tbaa !20
11  %conv = sext i8 %0 to i16, !dbg !19
12
13; CHECK: #dbg_value(i8 %0, !17, !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 16, DW_ATE_signed, DW_OP_stack_value), !18
14; CHECK-NEXT:  call i32 (...) @optimize_me_not()
15
16  call void @llvm.dbg.value(metadata i16 %conv, metadata !17, metadata !DIExpression()), !dbg !18
17  %call = call i32 (...) @optimize_me_not(), !dbg !23
18  %1 = load i8, ptr @a, align 1, !dbg !24, !tbaa !20
19  %conv1 = sext i8 %1 to i16, !dbg !24
20  ret i16 %conv1, !dbg !25
21}
22
23declare void @llvm.dbg.declare(metadata, metadata, metadata)
24declare i32 @optimize_me_not(...)
25
26define i32 @main() !dbg !26 {
27entry:
28  %call = call signext i16 @b(), !dbg !30
29  ret i32 0, !dbg !31
30}
31
32declare void @llvm.dbg.value(metadata, metadata, metadata)
33
34!llvm.dbg.cu = !{!2}
35!llvm.module.flags = !{!7, !8, !9, !10}
36!llvm.ident = !{!11}
37
38!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
39!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
40!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 8.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: GNU)
41!3 = !DIFile(filename: "patatino.c", directory: "/Users/davide/llvm-monorepo/llvm-mono/build/bin")
42!4 = !{}
43!5 = !{!0}
44!6 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
45!7 = !{i32 2, !"Dwarf Version", i32 4}
46!8 = !{i32 2, !"Debug Info Version", i32 3}
47!9 = !{i32 1, !"wchar_size", i32 4}
48!10 = !{i32 7, !"PIC Level", i32 2}
49!11 = !{!"clang version 8.0.0 "}
50!12 = distinct !DISubprogram(name: "b", scope: !3, file: !3, line: 2, type: !13, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !16)
51!13 = !DISubroutineType(types: !14)
52!14 = !{!15}
53!15 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)
54!16 = !{!17}
55!17 = !DILocalVariable(name: "i", scope: !12, file: !3, line: 3, type: !15)
56!18 = !DILocation(line: 3, column: 9, scope: !12)
57!19 = !DILocation(line: 4, column: 7, scope: !12)
58!20 = !{!21, !21, i64 0}
59!21 = !{!"omnipotent char", !22, i64 0}
60!22 = !{!"Simple C/C++ TBAA"}
61!23 = !DILocation(line: 5, column: 3, scope: !12)
62!24 = !DILocation(line: 6, column: 10, scope: !12)
63!25 = !DILocation(line: 6, column: 3, scope: !12)
64!26 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 8, type: !27, scopeLine: 8, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
65!27 = !DISubroutineType(types: !28)
66!28 = !{!29}
67!29 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
68!30 = !DILocation(line: 8, column: 14, scope: !26)
69!31 = !DILocation(line: 8, column: 19, scope: !26)
70