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