1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=loop-rotate -S | FileCheck %s
4 define dso_local i16 @main() local_unnamed_addr #0 !dbg !7 {
7 ; CHECK-NEXT: #dbg_value(i16 9, [[META12:![0-9]+]], !DIExpression(), [[META13:![0-9]+]])
8 ; CHECK-NEXT: br label [[BB2:%.*]], !dbg [[DBG14:![0-9]+]]
10 ; CHECK-NEXT: [[TMP1:%.*]] = phi i16 [ 9, [[ENTRY:%.*]] ], [ [[TMP5:%.*]], [[BB2]] ]
11 ; CHECK-NEXT: #dbg_value(i16 [[TMP1]], [[META12]], !DIExpression(), [[META13]])
12 ; CHECK-NEXT: [[TMP4:%.*]] = call i16 @wibble(i16 [[TMP1]]), !dbg [[DBG14]]
13 ; CHECK-NEXT: [[TMP5]] = add nsw i16 [[TMP4]], [[TMP1]], !dbg [[DBG14]]
14 ; CHECK-NEXT: #dbg_value(i16 [[TMP5]], [[META12]], !DIExpression(), [[META13]])
15 ; CHECK-NEXT: [[TMP6:%.*]] = call i16 @wibble(i16 [[TMP4]]), !dbg [[DBG14]]
16 ; CHECK-NEXT: [[TMP7:%.*]] = mul nsw i16 [[TMP6]], 3, !dbg [[DBG14]]
17 ; CHECK-NEXT: [[TMP8:%.*]] = call i16 @wibble(i16 [[TMP7]]), !dbg [[DBG14]]
18 ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i16 [[TMP5]], 17, !dbg [[DBG14]]
19 ; CHECK-NEXT: br i1 [[TMP2]], label [[BB2]], label [[BB3:%.*]], !dbg [[DBG14]]
21 ; CHECK-NEXT: [[TMP10:%.*]] = call i16 @wibble(i16 8), !dbg [[DBG14]]
22 ; CHECK-NEXT: ret i16 [[TMP10]], !dbg [[DBG14]]
25 call void @llvm.dbg.value(metadata i16 9, metadata !12, metadata !DIExpression()), !dbg !13
26 br label %bb1, !dbg !14
29 %tmp = phi i16 [ 9, %entry ], [ %tmp5, %bb2 ], !dbg !13
30 call void @llvm.dbg.value(metadata i16 %tmp, metadata !12, metadata !DIExpression()), !dbg !13
31 %tmp2 = icmp slt i16 %tmp, 17, !dbg !16
32 br i1 %tmp2, label %bb2, label %bb3, !dbg !16
35 %tmp4 = call i16 @wibble(i16 %tmp), !dbg !16
36 %tmp5 = add nsw i16 %tmp4, %tmp, !dbg !16
37 call void @llvm.dbg.value(metadata i16 %tmp5, metadata !12, metadata !DIExpression()), !dbg !13
38 %tmp6 = call i16 @wibble(i16 %tmp4), !dbg !16
39 %tmp7 = mul nsw i16 %tmp6, 3, !dbg !16
40 %tmp8 = call i16 @wibble(i16 %tmp7), !dbg !16
41 br label %bb1, !dbg !16
44 %tmp10 = call i16 @wibble(i16 8), !dbg !16
45 ret i16 %tmp10, !dbg !16
48 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
50 declare i16 @wibble(i16) #2
52 attributes #0 = { noinline nounwind }
53 attributes #1 = { nounwind readnone speculatable willreturn }
54 attributes #2 = { noinline nounwind readnone }
57 !llvm.module.flags = !{!3, !4, !5}
60 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !2, nameTableKind: None)
61 !1 = !DIFile(filename: "foo.c", directory: "")
63 !3 = !{i32 7, !"Dwarf Version", i32 4}
64 !4 = !{i32 2, !"Debug Info Version", i32 3}
65 !5 = !{i32 1, !"wchar_size", i32 1}
66 !6 = !{!"clang version 10.0.0"}
67 !7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 8, type: !8, scopeLine: 8, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
68 !8 = !DISubroutineType(types: !9)
70 !10 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
72 !12 = !DILocalVariable(name: "x", scope: !7, file: !1, line: 9, type: !10)
73 !13 = !DILocation(line: 0, scope: !7)
74 !14 = !DILocation(line: 11, column: 8, scope: !15)
75 !15 = distinct !DILexicalBlock(scope: !7, file: !1, line: 11, column: 3)
76 !16 = !DILocation(line: 11, column: 21, scope: !17)
77 !17 = distinct !DILexicalBlock(scope: !15, file: !1, line: 11, column: 3)