Home | History | Annotate | Download | only in Util
      1 ; RUN: opt -S -strip-nonlinetable-debuginfo %s -o %t
      2 ; RUN: cat %t | FileCheck %s
      3 ; RUN: cat %t | FileCheck %s --check-prefix=NEGATIVE
      4 ; void f(volatile int *i) {
      5 ;   while (--*i) {}
      6 ; }
      7 source_filename = "/tmp/loop.c"
      8 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
      9 target triple = "x86_64-apple-macosx10.12.0"
     10 
     11 define void @f(i32* %i) local_unnamed_addr #0 !dbg !7 {
     12 entry:
     13   tail call void @llvm.dbg.value(metadata i32* %i, metadata !14, metadata !15), !dbg !16
     14   br label %while.cond, !dbg !17
     15 
     16 while.cond:                                       ; preds = %while.cond, %entry
     17   %0 = load volatile i32, i32* %i, align 4, !dbg !18, !tbaa !19
     18   %dec = add nsw i32 %0, -1, !dbg !18
     19   store volatile i32 %dec, i32* %i, align 4, !dbg !18, !tbaa !19
     20   %tobool = icmp eq i32 %dec, 0, !dbg !17
     21   ; CHECK: !llvm.loop ![[LOOP:[0-9]+]]
     22   br i1 %tobool, label %while.end, label %while.cond, !dbg !17, !llvm.loop !23
     23 
     24 while.end:                                        ; preds = %while.cond
     25   ret void, !dbg !25
     26 }
     27 
     28 ; Function Attrs: nounwind readnone
     29 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
     30 
     31 attributes #0 = { nounwind ssp uwtable }
     32 attributes #1 = { nounwind readnone }
     33 
     34 !llvm.dbg.cu = !{!0}
     35 !llvm.module.flags = !{!3, !4, !5}
     36 !llvm.ident = !{!6}
     37 
     38 ; CHECK: ![[CU:.*]] = distinct !DICompileUnit(language: DW_LANG_C99,
     39 ; CHECK-SAME:                                 emissionKind: LineTablesOnly
     40 ; NEGATIVE-NOT: !DICompileUnit({{.*}} emissionKind: FullDebug
     41 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0 (trunk 298880) (llvm/trunk 298875)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
     42 !1 = !DIFile(filename: "/tmp/loop.c", directory: "/")
     43 !2 = !{}
     44 !3 = !{i32 2, !"Dwarf Version", i32 4}
     45 !4 = !{i32 2, !"Debug Info Version", i32 3}
     46 !5 = !{i32 1, !"PIC Level", i32 2}
     47 !6 = !{!"clang version 5.0.0 (trunk 298880) (llvm/trunk 298875)"}
     48 ; CHECK: ![[F:[0-9]]] = distinct !DISubprogram(name: "f", scope: !1
     49 !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !13)
     50 !8 = !DISubroutineType(types: !9)
     51 !9 = !{null, !10}
     52 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
     53 !11 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !12)
     54 ; NEGATIVE-NOT: !DIBasicType(name: "int",
     55 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
     56 !13 = !{!14}
     57 !14 = !DILocalVariable(name: "i", arg: 1, scope: !7, file: !1, line: 1, type: !10)
     58 !15 = !DIExpression()
     59 !16 = !DILocation(line: 1, column: 22, scope: !7)
     60 ; CHECK: ![[BEGIN:[0-9]+]] = !DILocation(line: 2, column: 3, scope: ![[F]])
     61 !17 = !DILocation(line: 2, column: 3, scope: !7)
     62 !18 = !DILocation(line: 2, column: 10, scope: !7)
     63 !19 = !{!20, !20, i64 0}
     64 !20 = !{!"int", !21, i64 0}
     65 !21 = !{!"omnipotent char", !22, i64 0}
     66 !22 = !{!"Simple C/C++ TBAA"}
     67 ; CHECK: ![[LOOP]] = distinct !{![[LOOP]], ![[BEGIN]], ![[END:[0-9]+]]}
     68 !23 = distinct !{!23, !17, !24}
     69 ; CHECK: ![[END]] = !DILocation(line: 3, column: 3, scope: ![[F]])
     70 !24 = !DILocation(line: 3, column: 3, scope: !7)
     71 !25 = !DILocation(line: 4, column: 1, scope: !7)
     72