• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -loop-rotate < %s | FileCheck %s
2; RUN: opt -S -loop-rotate -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
3
4;CHECK-LABEL: func
5;CHECK-LABEL: entry
6;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 %a
7;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 1, metadata ![[I_VAR:[0-9]+]], metadata !DIExpression())
8;CHECK-LABEL: for.body:
9;CHECK-NEXT: [[I:%.*]] = phi i32 [ 1, %entry ], [ %inc, %for.body ]
10;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 [[I]], metadata ![[I_VAR]], metadata !DIExpression())
11
12; CHECK: ![[I_VAR]] = !DILocalVariable(name: "i",{{.*}})
13
14; Function Attrs: noinline nounwind
15define void @func(i32 %a) local_unnamed_addr #0 !dbg !6 {
16entry:
17  tail call void @llvm.dbg.value(metadata i32 %a, metadata !10, metadata !11), !dbg !12
18  tail call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !11), !dbg !15
19  br label %for.cond, !dbg !16
20
21for.cond:                                         ; preds = %for.body, %entry
22  %i.0 = phi i32 [ 1, %entry ], [ %inc, %for.body ]
23  tail call void @llvm.dbg.value(metadata i32 %i.0, metadata !13, metadata !11), !dbg !15
24  %cmp = icmp slt i32 %i.0, 10, !dbg !17
25  br i1 %cmp, label %for.body, label %for.end, !dbg !20
26
27for.body:                                         ; preds = %for.cond
28  %add = add nsw i32 %i.0, %a, !dbg !22
29  %call = tail call i32 @func2(i32 %i.0, i32 %add) #3, !dbg !24
30  %inc = add nsw i32 %i.0, 1, !dbg !25
31  tail call void @llvm.dbg.value(metadata i32 %inc, metadata !13, metadata !11), !dbg !15
32  br label %for.cond, !dbg !27, !llvm.loop !28
33
34for.end:                                          ; preds = %for.cond
35  ret void, !dbg !31
36}
37
38declare i32 @func2(i32, i32) local_unnamed_addr
39
40; Function Attrs: nounwind readnone
41declare void @llvm.dbg.value(metadata, metadata, metadata) #2
42
43attributes #0 = { noinline nounwind }
44attributes #2 = { nounwind readnone }
45attributes #3 = { nounwind }
46
47!llvm.dbg.cu = !{!0}
48!llvm.module.flags = !{!3, !4}
49!llvm.ident = !{!5}
50
51!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
52!1 = !DIFile(filename: "debug-phi.c", directory: "/work/projects/src/tests/debug")
53!2 = !{}
54!3 = !{i32 2, !"Dwarf Version", i32 4}
55!4 = !{i32 2, !"Debug Info Version", i32 3}
56!5 = !{!"clang version 5.0.0"}
57!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, retainedNodes: !2)
58!7 = !DISubroutineType(types: !8)
59!8 = !{null, !9}
60!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
61!10 = !DILocalVariable(name: "a", arg: 1, scope: !6, file: !1, line: 2, type: !9)
62!11 = !DIExpression()
63!12 = !DILocation(line: 2, column: 15, scope: !6)
64!13 = !DILocalVariable(name: "i", scope: !14, file: !1, line: 3, type: !9)
65!14 = distinct !DILexicalBlock(scope: !6, file: !1, line: 3, column: 3)
66!15 = !DILocation(line: 3, column: 11, scope: !14)
67!16 = !DILocation(line: 3, column: 7, scope: !14)
68!17 = !DILocation(line: 3, column: 20, scope: !18)
69!18 = !DILexicalBlockFile(scope: !19, file: !1, discriminator: 1)
70!19 = distinct !DILexicalBlock(scope: !14, file: !1, line: 3, column: 3)
71!20 = !DILocation(line: 3, column: 3, scope: !21)
72!21 = !DILexicalBlockFile(scope: !14, file: !1, discriminator: 1)
73!22 = !DILocation(line: 4, column: 15, scope: !23)
74!23 = distinct !DILexicalBlock(scope: !19, file: !1, line: 3, column: 31)
75!24 = !DILocation(line: 4, column: 5, scope: !23)
76!25 = !DILocation(line: 3, column: 27, scope: !26)
77!26 = !DILexicalBlockFile(scope: !19, file: !1, discriminator: 2)
78!27 = !DILocation(line: 3, column: 3, scope: !26)
79!28 = distinct !{!28, !29, !30}
80!29 = !DILocation(line: 3, column: 3, scope: !14)
81!30 = !DILocation(line: 5, column: 3, scope: !14)
82!31 = !DILocation(line: 6, column: 1, scope: !6)
83