brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.5 KiB · 5e51624 Raw
203 lines · plain
1; RUN: opt -S -passes=loop-vectorize -pass-remarks-analysis=loop-vectorize -pass-remarks-with-hotness < %s 2>&1 | FileCheck %s2 3;   1	void cold(char *A, char *B, char *C, char *D, char *E, int N) {4;   2	  for(int i = 0; i < N; i++) {5;   3	    A[i + 1] = A[i] + B[i];6;   4	    C[i] = Dptr E[i];7;   5	  }8;   6	}9;   710;   8	void hot(char *A, char *B, char *C, char *D, char *E, int N) {11;   9	  for(int i = 0; i < N; i++) {12;  10	    A[i + 1] = A[i] + B[i];13;  11	    C[i] = Dptr E[i];14;  12	  }15;  13	}16;  1417;  15	void unknown(char *A, char *B, char *C, char *D, char *E, int N) {18;  16	  for(int i = 0; i < N; i++) {19;  17	    A[i + 1] = A[i] + B[i];20;  18	    C[i] = Dptr E[i];21;  19	  }22;  20	}23 24; CHECK: remark: /tmp/s.c:3:14: loop not vectorized: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop25; CHECK-NEXT: Backward loop carried data dependence. Memory location is the same as accessed at /tmp/s.c:3:16 (hotness: 300)26; CHECK: remark: /tmp/s.c:10:14: loop not vectorized: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop27; CHECK-NEXT: Backward loop carried data dependence. Memory location is the same as accessed at /tmp/s.c:10:16 (hotness: 5000)28; CHECK: remark: /tmp/s.c:17:14: loop not vectorized: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop29; CHECK-NEXT: Backward loop carried data dependence. Memory location is the same as accessed at /tmp/s.c:17:16{{$}}30 31; ModuleID = '/tmp/s.c'32source_filename = "/tmp/s.c"33target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"34 35; Function Attrs: norecurse nounwind ssp uwtable36define void @cold(ptr nocapture %A, ptr nocapture readonly %B, ptr nocapture %C, ptr nocapture readonly %D, ptr nocapture readonly %E, i32 %N) local_unnamed_addr #0 !dbg !7 !prof !56 {37entry:38  %cmp28 = icmp sgt i32 %N, 0, !dbg !939  br i1 %cmp28, label %ph, label %for.cond.cleanup, !dbg !10, !prof !5840 41ph:42  br label %for.body43 44for.body:45  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %ph ]46  %arrayidx = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !1247  %0 = load i8, ptr %arrayidx, align 1, !dbg !12, !tbaa !1348  %arrayidx2 = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !1649  %1 = load i8, ptr %arrayidx2, align 1, !dbg !16, !tbaa !1350  %add = add i8 %1, %0, !dbg !1751  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !1052  %arrayidx7 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv.next, !dbg !1853  store i8 %add, ptr %arrayidx7, align 1, !dbg !19, !tbaa !1354  %arrayidx9 = getelementptr inbounds i8, ptr %D, i64 %indvars.iv, !dbg !2055  %2 = load i8, ptr %arrayidx9, align 1, !dbg !20, !tbaa !1356  %arrayidx12 = getelementptr inbounds i8, ptr %E, i64 %indvars.iv, !dbg !2157  %3 = load i8, ptr %arrayidx12, align 1, !dbg !21, !tbaa !1358  %mul = mul i8 %3, %2, !dbg !2259  %arrayidx16 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !2360  store i8 %mul, ptr %arrayidx16, align 1, !dbg !24, !tbaa !1361  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !1062  %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !1063  br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !10, !llvm.loop !25, !prof !5964 65for.cond.cleanup:66  ret void, !dbg !1167}68 69; Function Attrs: norecurse nounwind ssp uwtable70define void @hot(ptr nocapture %A, ptr nocapture readonly %B, ptr nocapture %C, ptr nocapture readonly %D, ptr nocapture readonly %E, i32 %N) local_unnamed_addr #0 !dbg !26 !prof !57 {71entry:72  %cmp28 = icmp sgt i32 %N, 0, !dbg !2773  br i1 %cmp28, label %ph, label %for.cond.cleanup, !dbg !28, !prof !5874 75ph:76  br label %for.body77 78for.body:79  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %ph ]80  %arrayidx = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !3081  %0 = load i8, ptr %arrayidx, align 1, !dbg !30, !tbaa !1382  %arrayidx2 = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !3183  %1 = load i8, ptr %arrayidx2, align 1, !dbg !31, !tbaa !1384  %add = add i8 %1, %0, !dbg !3285  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !2886  %arrayidx7 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv.next, !dbg !3387  store i8 %add, ptr %arrayidx7, align 1, !dbg !34, !tbaa !1388  %arrayidx9 = getelementptr inbounds i8, ptr %D, i64 %indvars.iv, !dbg !3589  %2 = load i8, ptr %arrayidx9, align 1, !dbg !35, !tbaa !1390  %arrayidx12 = getelementptr inbounds i8, ptr %E, i64 %indvars.iv, !dbg !3691  %3 = load i8, ptr %arrayidx12, align 1, !dbg !36, !tbaa !1392  %mul = mul i8 %3, %2, !dbg !3793  %arrayidx16 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !3894  store i8 %mul, ptr %arrayidx16, align 1, !dbg !39, !tbaa !1395  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !2896  %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !2897  br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !28, !llvm.loop !40, !prof !5998 99for.cond.cleanup:100  ret void, !dbg !29101}102 103; Function Attrs: norecurse nounwind ssp uwtable104define void @unknown(ptr nocapture %A, ptr nocapture readonly %B, ptr nocapture %C, ptr nocapture readonly %D, ptr nocapture readonly %E, i32 %N) local_unnamed_addr #0 !dbg !41 {105entry:106  %cmp28 = icmp sgt i32 %N, 0, !dbg !42107  br i1 %cmp28, label %ph, label %for.cond.cleanup, !dbg !43108 109ph:110  br label %for.body111 112for.body:113  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %ph ]114  %arrayidx = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !45115  %0 = load i8, ptr %arrayidx, align 1, !dbg !45, !tbaa !13116  %arrayidx2 = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !46117  %1 = load i8, ptr %arrayidx2, align 1, !dbg !46, !tbaa !13118  %add = add i8 %1, %0, !dbg !47119  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !43120  %arrayidx7 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv.next, !dbg !48121  store i8 %add, ptr %arrayidx7, align 1, !dbg !49, !tbaa !13122  %arrayidx9 = getelementptr inbounds i8, ptr %D, i64 %indvars.iv, !dbg !50123  %2 = load i8, ptr %arrayidx9, align 1, !dbg !50, !tbaa !13124  %arrayidx12 = getelementptr inbounds i8, ptr %E, i64 %indvars.iv, !dbg !51125  %3 = load i8, ptr %arrayidx12, align 1, !dbg !51, !tbaa !13126  %mul = mul i8 %3, %2, !dbg !52127  %arrayidx16 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !53128  store i8 %mul, ptr %arrayidx16, align 1, !dbg !54, !tbaa !13129  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !43130  %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !43131  br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !43, !llvm.loop !55132 133for.cond.cleanup:134  ret void, !dbg !44135}136 137attributes #0 = { norecurse nounwind ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+fxsr,+mmx,+sse,+sse2,+sse3,+ssse3,+x87" "use-soft-float"="false" }138 139!llvm.dbg.cu = !{!0}140!llvm.module.flags = !{!3, !4, !5}141!llvm.ident = !{!6}142 143!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 273572) (llvm/trunk 273585)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)144!1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp")145!2 = !{}146!3 = !{i32 2, !"Dwarf Version", i32 2}147!4 = !{i32 2, !"Debug Info Version", i32 3}148!5 = !{i32 1, !"PIC Level", i32 2}149!6 = !{!"clang version 3.9.0 (trunk 273572) (llvm/trunk 273585)"}150!7 = distinct !DISubprogram(name: "cold", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)151!8 = !DISubroutineType(types: !2)152!9 = !DILocation(line: 2, column: 20, scope: !7)153!10 = !DILocation(line: 2, column: 3, scope: !7)154!11 = !DILocation(line: 6, column: 1, scope: !7)155!12 = !DILocation(line: 3, column: 16, scope: !7)156!13 = !{!14, !14, i64 0}157!14 = !{!"omnipotent char", !15, i64 0}158!15 = !{!"Simple C/C++ TBAA"}159!16 = !DILocation(line: 3, column: 23, scope: !7)160!17 = !DILocation(line: 3, column: 21, scope: !7)161!18 = !DILocation(line: 3, column: 5, scope: !7)162!19 = !DILocation(line: 3, column: 14, scope: !7)163!20 = !DILocation(line: 4, column: 12, scope: !7)164!21 = !DILocation(line: 4, column: 19, scope: !7)165!22 = !DILocation(line: 4, column: 17, scope: !7)166!23 = !DILocation(line: 4, column: 5, scope: !7)167!24 = !DILocation(line: 4, column: 10, scope: !7)168!25 = distinct !{!25, !10}169!26 = distinct !DISubprogram(name: "hot", scope: !1, file: !1, line: 8, type: !8, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)170!27 = !DILocation(line: 9, column: 20, scope: !26)171!28 = !DILocation(line: 9, column: 3, scope: !26)172!29 = !DILocation(line: 13, column: 1, scope: !26)173!30 = !DILocation(line: 10, column: 16, scope: !26)174!31 = !DILocation(line: 10, column: 23, scope: !26)175!32 = !DILocation(line: 10, column: 21, scope: !26)176!33 = !DILocation(line: 10, column: 5, scope: !26)177!34 = !DILocation(line: 10, column: 14, scope: !26)178!35 = !DILocation(line: 11, column: 12, scope: !26)179!36 = !DILocation(line: 11, column: 19, scope: !26)180!37 = !DILocation(line: 11, column: 17, scope: !26)181!38 = !DILocation(line: 11, column: 5, scope: !26)182!39 = !DILocation(line: 11, column: 10, scope: !26)183!40 = distinct !{!40, !28}184!41 = distinct !DISubprogram(name: "unknown", scope: !1, file: !1, line: 15, type: !8, isLocal: false, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)185!42 = !DILocation(line: 16, column: 20, scope: !41)186!43 = !DILocation(line: 16, column: 3, scope: !41)187!44 = !DILocation(line: 20, column: 1, scope: !41)188!45 = !DILocation(line: 17, column: 16, scope: !41)189!46 = !DILocation(line: 17, column: 23, scope: !41)190!47 = !DILocation(line: 17, column: 21, scope: !41)191!48 = !DILocation(line: 17, column: 5, scope: !41)192!49 = !DILocation(line: 17, column: 14, scope: !41)193!50 = !DILocation(line: 18, column: 12, scope: !41)194!51 = !DILocation(line: 18, column: 19, scope: !41)195!52 = !DILocation(line: 18, column: 17, scope: !41)196!53 = !DILocation(line: 18, column: 5, scope: !41)197!54 = !DILocation(line: 18, column: 10, scope: !41)198!55 = distinct !{!55, !43}199!56 = !{!"function_entry_count", i64 3}200!57 = !{!"function_entry_count", i64 50}201!58 = !{!"branch_weights", i32 10000, i32 1}202!59 = !{!"branch_weights", i32 1, i32 99}203