blob: ee7df2671164b53ee0f8974d7fb88330f5ff2259 [file] [log] [blame]
Manman Ren620e9782013-07-29 20:18:19 +00001; RUN: opt -simplifycfg -S < %s | FileCheck %s
Devang Patel197c3522011-04-07 17:27:36 +00002
3define i32 @foo(i32 %i) nounwind ssp {
Duncan P. N. Exon Smith166121a2015-03-15 01:21:30 +00004 call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !6, metadata !MDExpression()), !dbg !7
5 call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !9, metadata !MDExpression()), !dbg !11
Devang Patel197c3522011-04-07 17:27:36 +00006 %1 = icmp ne i32 %i, 0, !dbg !12
David Blaikie23af6482015-04-16 23:24:18 +00007;CHECK: call i32 (...) @bar()
Devang Patel197c3522011-04-07 17:27:36 +00008;CHECK-NEXT: llvm.dbg.value
9 br i1 %1, label %2, label %4, !dbg !12
10
11; <label>:2 ; preds = %0
David Blaikie23af6482015-04-16 23:24:18 +000012 %3 = call i32 (...) @bar(), !dbg !13
Duncan P. N. Exon Smith166121a2015-03-15 01:21:30 +000013 call void @llvm.dbg.value(metadata i32 %3, i64 0, metadata !9, metadata !MDExpression()), !dbg !13
Devang Patel197c3522011-04-07 17:27:36 +000014 br label %6, !dbg !15
15
16; <label>:4 ; preds = %0
David Blaikie23af6482015-04-16 23:24:18 +000017 %5 = call i32 (...) @bar(), !dbg !16
Duncan P. N. Exon Smith166121a2015-03-15 01:21:30 +000018 call void @llvm.dbg.value(metadata i32 %5, i64 0, metadata !9, metadata !MDExpression()), !dbg !16
Devang Patel197c3522011-04-07 17:27:36 +000019 br label %6, !dbg !18
20
21; <label>:6 ; preds = %4, %2
22 %k.0 = phi i32 [ %3, %2 ], [ %5, %4 ]
23 ret i32 %k.0, !dbg !19
24}
25
Adrian Prantl87b7eb92014-10-01 18:55:02 +000026declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Devang Patel197c3522011-04-07 17:27:36 +000027
28declare i32 @bar(...)
29
Adrian Prantl87b7eb92014-10-01 18:55:02 +000030declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
Devang Patel197c3522011-04-07 17:27:36 +000031
Manman Rend664bd72013-11-23 01:16:29 +000032!llvm.module.flags = !{!21}
Devang Patel197c3522011-04-07 17:27:36 +000033!llvm.dbg.sp = !{!0}
34
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000035!0 = !MDSubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !20, scope: !1, type: !3, function: i32 (i32)* @foo)
36!1 = !MDFile(filename: "b.c", directory: "/private/tmp")
37!2 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: 0, file: !20, enums: !8, retainedTypes: !8)
38!3 = !MDSubroutineType(types: !4)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000039!4 = !{!5}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000040!5 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
41!6 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "i", line: 2, arg: 1, scope: !0, file: !1, type: !5)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000042!7 = !MDLocation(line: 2, column: 13, scope: !0)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000043!8 = !{i32 0}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000044!9 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "k", line: 3, scope: !10, file: !1, type: !5)
45!10 = distinct !MDLexicalBlock(line: 2, column: 16, file: !20, scope: !0)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000046!11 = !MDLocation(line: 3, column: 12, scope: !10)
47!12 = !MDLocation(line: 4, column: 3, scope: !10)
48!13 = !MDLocation(line: 5, column: 5, scope: !14)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000049!14 = distinct !MDLexicalBlock(line: 4, column: 10, file: !20, scope: !10)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000050!15 = !MDLocation(line: 6, column: 3, scope: !14)
51!16 = !MDLocation(line: 7, column: 5, scope: !17)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000052!17 = distinct !MDLexicalBlock(line: 6, column: 10, file: !20, scope: !10)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000053!18 = !MDLocation(line: 8, column: 3, scope: !17)
54!19 = !MDLocation(line: 9, column: 3, scope: !10)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000055!20 = !MDFile(filename: "b.c", directory: "/private/tmp")
56!21 = !{i32 1, !"Debug Info Version", i32 3}