blob: 6aa2fdb9f2b674de32fcc563dcf7bd8272523837 [file] [log] [blame]
Sam Parker0f4db382017-03-08 09:56:22 +00001; RUN: opt -S -loop-rotate < %s | FileCheck %s
2
3;CHECK-LABEL: func
4;CHECK-LABEL: entry
5;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 %a
Adrian Prantlabe04752017-07-28 20:21:02 +00006;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !11), !dbg !15
Sam Parker0f4db382017-03-08 09:56:22 +00007;CHECK-LABEL: for.body:
8;CHECK-NEXT: [[I:%.*]] = phi i32 [ 1, %entry ], [ %inc, %for.body ]
Adrian Prantlabe04752017-07-28 20:21:02 +00009;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 [[I]], metadata !13, metadata !11), !dbg !15
Sam Parker0f4db382017-03-08 09:56:22 +000010
11; Function Attrs: noinline nounwind
12define void @func(i32 %a) local_unnamed_addr #0 !dbg !6 {
13entry:
Adrian Prantlabe04752017-07-28 20:21:02 +000014 tail call void @llvm.dbg.value(metadata i32 %a, metadata !10, metadata !11), !dbg !12
15 tail call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !11), !dbg !15
Sam Parker0f4db382017-03-08 09:56:22 +000016 br label %for.cond, !dbg !16
17
18for.cond: ; preds = %for.body, %entry
19 %i.0 = phi i32 [ 1, %entry ], [ %inc, %for.body ]
Adrian Prantlabe04752017-07-28 20:21:02 +000020 tail call void @llvm.dbg.value(metadata i32 %i.0, metadata !13, metadata !11), !dbg !15
Sam Parker0f4db382017-03-08 09:56:22 +000021 %cmp = icmp slt i32 %i.0, 10, !dbg !17
22 br i1 %cmp, label %for.body, label %for.end, !dbg !20
23
24for.body: ; preds = %for.cond
25 %add = add nsw i32 %i.0, %a, !dbg !22
26 %call = tail call i32 @func2(i32 %i.0, i32 %add) #3, !dbg !24
27 %inc = add nsw i32 %i.0, 1, !dbg !25
Adrian Prantlabe04752017-07-28 20:21:02 +000028 tail call void @llvm.dbg.value(metadata i32 %inc, metadata !13, metadata !11), !dbg !15
Sam Parker0f4db382017-03-08 09:56:22 +000029 br label %for.cond, !dbg !27, !llvm.loop !28
30
31for.end: ; preds = %for.cond
32 ret void, !dbg !31
33}
34
35declare i32 @func2(i32, i32) local_unnamed_addr
36
37; Function Attrs: nounwind readnone
Adrian Prantlabe04752017-07-28 20:21:02 +000038declare void @llvm.dbg.value(metadata, metadata, metadata) #2
Sam Parker0f4db382017-03-08 09:56:22 +000039
40attributes #0 = { noinline nounwind }
41attributes #2 = { nounwind readnone }
42attributes #3 = { nounwind }
43
44!llvm.dbg.cu = !{!0}
45!llvm.module.flags = !{!3, !4}
46!llvm.ident = !{!5}
47
48!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0 (http://llvm.org/git/clang.git 0f3ed908c1f13f83da4b240f7595eb8d05e0a754) (http://llvm.org/git/llvm.git 8e270f5a6b8ceb0f3ac3ef1ffb83c5e29b44ae68)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
49!1 = !DIFile(filename: "debug-phi.c", directory: "/work/projects/src/tests/debug")
50!2 = !{}
51!3 = !{i32 2, !"Dwarf Version", i32 4}
52!4 = !{i32 2, !"Debug Info Version", i32 3}
53!5 = !{!"clang version 5.0.0 (http://llvm.org/git/clang.git 0f3ed908c1f13f83da4b240f7595eb8d05e0a754) (http://llvm.org/git/llvm.git 8e270f5a6b8ceb0f3ac3ef1ffb83c5e29b44ae68)"}
54!6 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
55!7 = !DISubroutineType(types: !8)
56!8 = !{null, !9}
57!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
58!10 = !DILocalVariable(name: "a", arg: 1, scope: !6, file: !1, line: 2, type: !9)
59!11 = !DIExpression()
60!12 = !DILocation(line: 2, column: 15, scope: !6)
61!13 = !DILocalVariable(name: "i", scope: !14, file: !1, line: 3, type: !9)
62!14 = distinct !DILexicalBlock(scope: !6, file: !1, line: 3, column: 3)
63!15 = !DILocation(line: 3, column: 11, scope: !14)
64!16 = !DILocation(line: 3, column: 7, scope: !14)
65!17 = !DILocation(line: 3, column: 20, scope: !18)
66!18 = !DILexicalBlockFile(scope: !19, file: !1, discriminator: 1)
67!19 = distinct !DILexicalBlock(scope: !14, file: !1, line: 3, column: 3)
68!20 = !DILocation(line: 3, column: 3, scope: !21)
69!21 = !DILexicalBlockFile(scope: !14, file: !1, discriminator: 1)
70!22 = !DILocation(line: 4, column: 15, scope: !23)
71!23 = distinct !DILexicalBlock(scope: !19, file: !1, line: 3, column: 31)
72!24 = !DILocation(line: 4, column: 5, scope: !23)
73!25 = !DILocation(line: 3, column: 27, scope: !26)
74!26 = !DILexicalBlockFile(scope: !19, file: !1, discriminator: 2)
75!27 = !DILocation(line: 3, column: 3, scope: !26)
76!28 = distinct !{!28, !29, !30}
77!29 = !DILocation(line: 3, column: 3, scope: !14)
78!30 = !DILocation(line: 5, column: 3, scope: !14)
79!31 = !DILocation(line: 6, column: 1, scope: !6)