Home | History | Annotate | Download | only in SimplifyCFG
      1 ; RUN: opt -simplifycfg -S < %s | FileCheck %s
      2 
      3 define i32 @foo(i32 %i) nounwind ssp !dbg !0 {
      4   call void @llvm.dbg.value(metadata i32 %i, metadata !6, metadata !DIExpression()), !dbg !7
      5   call void @llvm.dbg.value(metadata i32 0, metadata !9, metadata !DIExpression()), !dbg !11
      6   %1 = icmp ne i32 %i, 0, !dbg !12
      7 ;CHECK: call i32 (...) @bar()
      8 ;CHECK-NEXT: llvm.dbg.value
      9   br i1 %1, label %2, label %4, !dbg !12
     10 
     11 ; <label>:2                                       ; preds = %0
     12   %3 = call i32 (...) @bar(), !dbg !13
     13   call void @llvm.dbg.value(metadata i32 %3, metadata !9, metadata !DIExpression()), !dbg !13
     14   br label %6, !dbg !15
     15 
     16 ; <label>:4                                       ; preds = %0
     17   %5 = call i32 (...) @bar(), !dbg !16
     18   call void @llvm.dbg.value(metadata i32 %5, metadata !9, metadata !DIExpression()), !dbg !16
     19   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 
     26 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
     27 
     28 declare i32 @bar(...)
     29 
     30 declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone
     31 
     32 !llvm.module.flags = !{!21}
     33 !llvm.dbg.cu = !{!2}
     34 
     35 !0 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !20, scope: !1, type: !3)
     36 !1 = !DIFile(filename: "b.c", directory: "/private/tmp")
     37 !2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: FullDebug, file: !20)
     38 !3 = !DISubroutineType(types: !4)
     39 !4 = !{!5}
     40 !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
     41 !6 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !0, file: !1, type: !5)
     42 !7 = !DILocation(line: 2, column: 13, scope: !0)
     43 !9 = !DILocalVariable(name: "k", line: 3, scope: !10, file: !1, type: !5)
     44 !10 = distinct !DILexicalBlock(line: 2, column: 16, file: !20, scope: !0)
     45 !11 = !DILocation(line: 3, column: 12, scope: !10)
     46 !12 = !DILocation(line: 4, column: 3, scope: !10)
     47 !13 = !DILocation(line: 5, column: 5, scope: !14)
     48 !14 = distinct !DILexicalBlock(line: 4, column: 10, file: !20, scope: !10)
     49 !15 = !DILocation(line: 6, column: 3, scope: !14)
     50 !16 = !DILocation(line: 7, column: 5, scope: !17)
     51 !17 = distinct !DILexicalBlock(line: 6, column: 10, file: !20, scope: !10)
     52 !18 = !DILocation(line: 8, column: 3, scope: !17)
     53 !19 = !DILocation(line: 9, column: 3, scope: !10)
     54 !20 = !DIFile(filename: "b.c", directory: "/private/tmp")
     55 !21 = !{i32 1, !"Debug Info Version", i32 3}
     56