86 lines · plain
1; RUN: opt %s -passes=loop-deletion -S | FileCheck %s --implicit-check-not=dbg_value2 3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-apple-macosx10.14.0"5 6@a = common local_unnamed_addr global i32 0, align 4, !dbg !07 8define i32 @b() local_unnamed_addr !dbg !12 {9; CHECK-LABEL: entry10; CHECK: #dbg_value(i32 0, ![[IVAR:[0-9]+]],11; CHECK-LABEL: for.end:12; CHECK-NEXT: #dbg_value(i32 poison, ![[IVAR]], !DIExpression(), !1713; CHECK-NEXT: #dbg_value(i32 poison, ![[JVAR:[0-9]+]], !DIExpression(), !1714; CHECK-NEXT: %call = tail call i32 {{.*}} @patatino()15entry:16 call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !DIExpression()), !dbg !1717 br label %for.cond, !dbg !1818 19for.cond: ; preds = %for.cond, %entry20 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.cond ], !dbg !2021 call void @llvm.dbg.value(metadata i32 %i.0, metadata !16, metadata !DIExpression()), !dbg !1722 %inc = add nuw nsw i32 %i.0, 1, !dbg !2123 call void @llvm.dbg.value(metadata i32 %inc, metadata !16, metadata !DIExpression()), !dbg !1724 call void @llvm.dbg.value(metadata i32 %inc, metadata !37, metadata !DIExpression()), !dbg !1725 %exitcond = icmp ne i32 %inc, 3, !dbg !2326 br i1 %exitcond, label %for.cond, label %for.end, !dbg !24, !llvm.loop !2527 28for.end: ; preds = %for.cond29 %call = tail call i32 (...) @patatino() #3, !dbg !2730 %0 = load i32, ptr @a, align 4, !dbg !2831 ret i32 %0, !dbg !3332}33 34declare i32 @patatino(...) local_unnamed_addr35 36define i32 @main() local_unnamed_addr !dbg !34 {37entry:38 %call = call i32 @b(), !dbg !3539 ret i32 0, !dbg !3640}41 42 43; CHECK: ![[IVAR]] = !DILocalVariable(name: "i",44; CHECK: ![[JVAR]] = !DILocalVariable(name: "j",45 46declare void @llvm.dbg.value(metadata, metadata, metadata)47 48!llvm.dbg.cu = !{!2}49!llvm.module.flags = !{!7, !8, !9, !10}50!llvm.ident = !{!11}51 52!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())53!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)54!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)55!3 = !DIFile(filename: "a.c", directory: "/Users/davide/work/llvm-project-20170507/build-debug/bin")56!4 = !{}57!5 = !{!0}58!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)59!7 = !{i32 2, !"Dwarf Version", i32 4}60!8 = !{i32 2, !"Debug Info Version", i32 3}61!9 = !{i32 1, !"wchar_size", i32 4}62!10 = !{i32 7, !"PIC Level", i32 2}63!11 = !{!"clang version 8.0.0 "}64!12 = distinct !DISubprogram(name: "b", scope: !3, file: !3, line: 2, type: !13, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !15)65!13 = !DISubroutineType(types: !14)66!14 = !{!6}67!15 = !{!16}68!16 = !DILocalVariable(name: "i", scope: !12, file: !3, line: 3, type: !6)69!17 = !DILocation(line: 3, column: 7, scope: !12)70!18 = !DILocation(line: 4, column: 8, scope: !19)71!19 = distinct !DILexicalBlock(scope: !12, file: !3, line: 4, column: 3)72!20 = !DILocation(line: 0, scope: !19)73!21 = !DILocation(line: 4, column: 23, scope: !22)74!22 = distinct !DILexicalBlock(scope: !19, file: !3, line: 4, column: 3)75!23 = !DILocation(line: 4, column: 17, scope: !22)76!24 = !DILocation(line: 4, column: 3, scope: !19)77!25 = distinct !{!25, !24, !26}78!26 = !DILocation(line: 5, column: 5, scope: !19)79!27 = !DILocation(line: 6, column: 3, scope: !12)80!28 = !DILocation(line: 7, column: 10, scope: !12)81!33 = !DILocation(line: 7, column: 3, scope: !12)82!34 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 9, type: !13, scopeLine: 9, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)83!35 = !DILocation(line: 9, column: 14, scope: !34)84!36 = !DILocation(line: 9, column: 19, scope: !34)85!37 = !DILocalVariable(name: "j", scope: !12, file: !3, line: 3, type: !6)86