brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 2dc5157 Raw
83 lines · plain
1; RUN: opt -mcpu=cyclone -mtriple=arm64-apple-ios -passes=loop-data-prefetch \2; RUN:     -pass-remarks=loop-data-prefetch -S -max-prefetch-iters-ahead=100 \3; RUN:     -pass-remarks-with-hotness \4; RUN:     < %s 2>&1 | FileCheck %s5 6; ModuleID = '/tmp/s.c'7source_filename = "/tmp/s.c"8target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"9target triple = "arm64-apple-ios5.0.0"10 11;   1	struct MyStruct {12;   2	  int field;13;   3	  char kk[2044];14;   4	} *my_struct;15;   516;   6	int f(struct MyStruct *p, int N) {17;   7	  int total = 0;18;   8	  for (int i = 0; i < N; i++) {19;   9	    total += my_struct[i].field;20;  10	  }21;  11	  return total;22;  12	}23 24; CHECK: remark: /tmp/s.c:9:27: prefetched memory access (hotness: 600)25 26%struct.MyStruct = type { i32, [2044 x i8] }27 28@my_struct = common global ptr null, align 829 30define i32 @f(ptr nocapture readnone %p, i32 %N) !dbg !6 !prof !21 {31entry:32  %cmp6 = icmp sgt i32 %N, 0, !dbg !833  br i1 %cmp6, label %for.body.lr.ph, label %for.cond.cleanup, !dbg !9, !prof !2234 35for.body.lr.ph:                                   ; preds = %entry36  %0 = load ptr, ptr @my_struct, align 8, !dbg !10, !tbaa !1137  br label %for.body, !dbg !938 39for.cond.cleanup:                                 ; preds = %for.body, %entry40  %total.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]41  ret i32 %total.0.lcssa, !dbg !1542 43for.body:                                         ; preds = %for.body, %for.body.lr.ph44  %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]45  %total.07 = phi i32 [ 0, %for.body.lr.ph ], [ %add, %for.body ]46  %field = getelementptr inbounds %struct.MyStruct, ptr %0, i64 %indvars.iv, i32 0, !dbg !1647  %1 = load i32, ptr %field, align 4, !dbg !16, !tbaa !1748  %add = add nsw i32 %1, %total.07, !dbg !2049  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !950  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !951  %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !952  br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !9, !prof !2353}54 55!llvm.dbg.cu = !{!0}56!llvm.module.flags = !{!3, !4}57!llvm.ident = !{!5}58 59!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)60!1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp")61!2 = !{}62!3 = !{i32 2, !"Debug Info Version", i32 3}63!4 = !{i32 1, !"PIC Level", i32 2}64!5 = !{!"clang version 3.9.0"}65!6 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 6, type: !7, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)66!7 = !DISubroutineType(types: !2)67!8 = !DILocation(line: 8, column: 21, scope: !6)68!9 = !DILocation(line: 8, column: 3, scope: !6)69!10 = !DILocation(line: 9, column: 14, scope: !6)70!11 = !{!12, !12, i64 0}71!12 = !{!"any pointer", !13, i64 0}72!13 = !{!"omnipotent char", !14, i64 0}73!14 = !{!"Simple C/C++ TBAA"}74!15 = !DILocation(line: 11, column: 3, scope: !6)75!16 = !DILocation(line: 9, column: 27, scope: !6)76!17 = !{!18, !19, i64 0}77!18 = !{!"MyStruct", !19, i64 0, !13, i64 4}78!19 = !{!"int", !13, i64 0}79!20 = !DILocation(line: 9, column: 11, scope: !6)80!21 = !{!"function_entry_count", i64 6}81!22 = !{!"branch_weights", i32 2000, i32 1}82!23 = !{!"branch_weights", i32 1, i32 99}83