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 3source_filename = "/tmp/loop.c" 4target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-apple-macosx10.13.0" 6 7; Function Attrs: nounwind ssp uwtable 8define void @f(float* %input, i64 %n, i64 %s) local_unnamed_addr #0 !dbg !8 { 9entry: 10 call void @llvm.dbg.value(metadata float* %input, metadata !15, metadata !DIExpression()), !dbg !20 11 call void @llvm.dbg.value(metadata i64 %n, metadata !16, metadata !DIExpression()), !dbg !21 12 call void @llvm.dbg.value(metadata i64 %s, metadata !17, metadata !DIExpression()), !dbg !22 13 call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23 14 ; CHECK: call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23 15 ; CHECK-NOT: call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23 16 br label %for.cond, !dbg !24 17 18for.cond: ; preds = %for.body, %entry 19 ; CHECK: %i.02 = phi i64 [ 0, %for.body.lr.ph ], [ %add, %for.body ] 20 %i.0 = phi i64 [ 0, %entry ], [ %add, %for.body ] 21 call void @llvm.dbg.value(metadata i64 %i.0, metadata !18, metadata !DIExpression()), !dbg !23 22 %cmp = icmp slt i64 %i.0, %n, !dbg !25 23 br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !27 24 25for.cond.cleanup: ; preds = %for.cond 26 ret void, !dbg !28 27 28for.body: ; preds = %for.cond 29 %arrayidx = getelementptr inbounds float, float* %input, i64 %i.0, !dbg !29 30 %0 = load float, float* %arrayidx, align 4, !dbg !29, !tbaa !30 31 call void @bar(float %0), !dbg !34 32 %add = add nsw i64 %i.0, %s, !dbg !35 33 call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23 34 ; CHECK: call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23 35 ; CHECK-NOT: call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23 36 br label %for.cond, !dbg !36, !llvm.loop !37 37} 38 39declare void @bar(float) local_unnamed_addr #1 40 41; Function Attrs: nounwind readnone speculatable 42declare void @llvm.dbg.value(metadata, metadata, metadata) #2 43 44attributes #0 = { nounwind ssp uwtable } 45attributes #2 = { nounwind readnone speculatable } 46 47!llvm.dbg.cu = !{!0} 48!llvm.module.flags = !{!3, !4, !5, !6} 49!llvm.ident = !{!7} 50 51!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 (trunk 316689) (llvm/trunk 316685)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 52!1 = !DIFile(filename: "/tmp/loop.c", directory: "/Data/llvm") 53!2 = !{} 54!3 = !{i32 2, !"Dwarf Version", i32 4} 55!4 = !{i32 2, !"Debug Info Version", i32 3} 56!5 = !{i32 1, !"wchar_size", i32 4} 57!6 = !{i32 7, !"PIC Level", i32 2} 58!7 = !{!"clang version 6.0.0 (trunk 316689) (llvm/trunk 316685)"} 59!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !14) 60!9 = !DISubroutineType(types: !10) 61!10 = !{null, !11, !13, !13} 62!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64) 63!12 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float) 64!13 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed) 65!14 = !{!15, !16, !17, !18} 66!15 = !DILocalVariable(name: "input", arg: 1, scope: !8, file: !1, line: 2, type: !11) 67!16 = !DILocalVariable(name: "n", arg: 2, scope: !8, file: !1, line: 2, type: !13) 68!17 = !DILocalVariable(name: "s", arg: 3, scope: !8, file: !1, line: 2, type: !13) 69!18 = !DILocalVariable(name: "i", scope: !19, file: !1, line: 3, type: !13) 70!19 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3, column: 3) 71!20 = !DILocation(line: 2, column: 15, scope: !8) 72!21 = !DILocation(line: 2, column: 32, scope: !8) 73!22 = !DILocation(line: 2, column: 45, scope: !8) 74!23 = !DILocation(line: 3, column: 18, scope: !19) 75!24 = !DILocation(line: 3, column: 8, scope: !19) 76!25 = !DILocation(line: 3, column: 26, scope: !26) 77!26 = distinct !DILexicalBlock(scope: !19, file: !1, line: 3, column: 3) 78!27 = !DILocation(line: 3, column: 3, scope: !19) 79!28 = !DILocation(line: 5, column: 1, scope: !8) 80!29 = !DILocation(line: 4, column: 9, scope: !26) 81!30 = !{!31, !31, i64 0} 82!31 = !{!"float", !32, i64 0} 83!32 = !{!"omnipotent char", !33, i64 0} 84!33 = !{!"Simple C/C++ TBAA"} 85!34 = !DILocation(line: 4, column: 5, scope: !26) 86!35 = !DILocation(line: 3, column: 31, scope: !26) 87!36 = !DILocation(line: 3, column: 3, scope: !26) 88!37 = distinct !{!37, !27, !38} 89!38 = !DILocation(line: 4, column: 17, scope: !19) 90