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