214 lines · plain
1; RUN: opt -S -passes=loop-vectorize -pass-remarks-missed=loop-vectorize \2; RUN: -pass-remarks-with-hotness < %s 2>&1 | \3; RUN: FileCheck -check-prefix=HOTNESS -check-prefix=BOTH %s4 5; RUN: opt -S -passes=loop-vectorize -pass-remarks-missed=loop-vectorize < %s 2>&1 | \6; RUN: FileCheck -check-prefix=NO_HOTNESS -check-prefix=BOTH %s7 8 9; RUN: opt -S -passes=loop-vectorize -pass-remarks-missed=loop-vectorize \10; RUN: -pass-remarks-with-hotness < %s 2>&1 | \11; RUN: FileCheck -check-prefix=HOTNESS -check-prefix=BOTH %s12 13; RUN: opt -S -passes=loop-vectorize \14; RUN: -pass-remarks-missed=loop-vectorize < %s 2>&1 | \15; RUN: FileCheck -check-prefix=NO_HOTNESS -check-prefix=BOTH %s16 17 18; 1 void cold(char *A, char *B, char *C, char *D, char *E, int N) {19; 2 for(int i = 0; i < N; i++) {20; 3 A[i + 1] = A[i] + B[i];21; 4 C[i] = Dptr E[i];22; 5 }23; 6 }24; 725; 8 void hot(char *A, char *B, char *C, char *D, char *E, int N) {26; 9 for(int i = 0; i < N; i++) {27; 10 A[i + 1] = A[i] + B[i];28; 11 C[i] = Dptr E[i];29; 12 }30; 13 }31; 1432; 15 void unknown(char *A, char *B, char *C, char *D, char *E, int N) {33; 16 for(int i = 0; i < N; i++) {34; 17 A[i + 1] = A[i] + B[i];35; 18 C[i] = Dptr E[i];36; 19 }37; 20 }38 39; HOTNESS: remark: /tmp/s.c:2:3: loop not vectorized (hotness: 300)40; NO_HOTNESS: remark: /tmp/s.c:2:3: loop not vectorized{{$}}41; HOTNESS: remark: /tmp/s.c:9:3: loop not vectorized (hotness: 5000)42; NO_HOTNESS: remark: /tmp/s.c:9:3: loop not vectorized{{$}}43; BOTH: remark: /tmp/s.c:16:3: loop not vectorized{{$}}44 45; ModuleID = '/tmp/s.c'46source_filename = "/tmp/s.c"47target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"48 49; Function Attrs: norecurse nounwind ssp uwtable50define 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 {51entry:52 %cmp28 = icmp sgt i32 %N, 0, !dbg !953 br i1 %cmp28, label %ph, label %for.cond.cleanup, !dbg !10, !prof !5854 55ph:56 br label %for.body57 58for.body:59 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %ph ]60 %arrayidx = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !1261 %0 = load i8, ptr %arrayidx, align 1, !dbg !12, !tbaa !1362 %arrayidx2 = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !1663 %1 = load i8, ptr %arrayidx2, align 1, !dbg !16, !tbaa !1364 %add = add i8 %1, %0, !dbg !1765 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !1066 %arrayidx7 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv.next, !dbg !1867 store i8 %add, ptr %arrayidx7, align 1, !dbg !19, !tbaa !1368 %arrayidx9 = getelementptr inbounds i8, ptr %D, i64 %indvars.iv, !dbg !2069 %2 = load i8, ptr %arrayidx9, align 1, !dbg !20, !tbaa !1370 %arrayidx12 = getelementptr inbounds i8, ptr %E, i64 %indvars.iv, !dbg !2171 %3 = load i8, ptr %arrayidx12, align 1, !dbg !21, !tbaa !1372 %mul = mul i8 %3, %2, !dbg !2273 %arrayidx16 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !2374 store i8 %mul, ptr %arrayidx16, align 1, !dbg !24, !tbaa !1375 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !1076 %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !1077 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !10, !llvm.loop !25, !prof !5978 79for.cond.cleanup:80 ret void, !dbg !1181}82 83; Function Attrs: norecurse nounwind ssp uwtable84define 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 {85entry:86 %cmp28 = icmp sgt i32 %N, 0, !dbg !2787 br i1 %cmp28, label %ph, label %for.cond.cleanup, !dbg !28, !prof !5888 89ph:90 br label %for.body91 92for.body:93 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %ph ]94 %arrayidx = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !3095 %0 = load i8, ptr %arrayidx, align 1, !dbg !30, !tbaa !1396 %arrayidx2 = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !3197 %1 = load i8, ptr %arrayidx2, align 1, !dbg !31, !tbaa !1398 %add = add i8 %1, %0, !dbg !3299 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !28100 %arrayidx7 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv.next, !dbg !33101 store i8 %add, ptr %arrayidx7, align 1, !dbg !34, !tbaa !13102 %arrayidx9 = getelementptr inbounds i8, ptr %D, i64 %indvars.iv, !dbg !35103 %2 = load i8, ptr %arrayidx9, align 1, !dbg !35, !tbaa !13104 %arrayidx12 = getelementptr inbounds i8, ptr %E, i64 %indvars.iv, !dbg !36105 %3 = load i8, ptr %arrayidx12, align 1, !dbg !36, !tbaa !13106 %mul = mul i8 %3, %2, !dbg !37107 %arrayidx16 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !38108 store i8 %mul, ptr %arrayidx16, align 1, !dbg !39, !tbaa !13109 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !28110 %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !28111 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !28, !llvm.loop !40, !prof !59112 113for.cond.cleanup:114 ret void, !dbg !29115}116 117; Function Attrs: norecurse nounwind ssp uwtable118define 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 {119entry:120 %cmp28 = icmp sgt i32 %N, 0, !dbg !42121 br i1 %cmp28, label %for.body, label %for.cond.cleanup, !dbg !43122 123for.cond.cleanup: ; preds = %for.body, %entry124 ret void, !dbg !44125 126for.body: ; preds = %entry, %for.body127 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]128 %arrayidx = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !45129 %0 = load i8, ptr %arrayidx, align 1, !dbg !45, !tbaa !13130 %arrayidx2 = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !46131 %1 = load i8, ptr %arrayidx2, align 1, !dbg !46, !tbaa !13132 %add = add i8 %1, %0, !dbg !47133 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !43134 %arrayidx7 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv.next, !dbg !48135 store i8 %add, ptr %arrayidx7, align 1, !dbg !49, !tbaa !13136 %arrayidx9 = getelementptr inbounds i8, ptr %D, i64 %indvars.iv, !dbg !50137 %2 = load i8, ptr %arrayidx9, align 1, !dbg !50, !tbaa !13138 %arrayidx12 = getelementptr inbounds i8, ptr %E, i64 %indvars.iv, !dbg !51139 %3 = load i8, ptr %arrayidx12, align 1, !dbg !51, !tbaa !13140 %mul = mul i8 %3, %2, !dbg !52141 %arrayidx16 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !53142 store i8 %mul, ptr %arrayidx16, align 1, !dbg !54, !tbaa !13143 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !43144 %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !43145 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !43, !llvm.loop !55146}147 148attributes #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" }149 150!llvm.dbg.cu = !{!0}151!llvm.module.flags = !{!3, !4, !5}152!llvm.ident = !{!6}153 154!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)155!1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp")156!2 = !{}157!3 = !{i32 2, !"Dwarf Version", i32 2}158!4 = !{i32 2, !"Debug Info Version", i32 3}159!5 = !{i32 1, !"PIC Level", i32 2}160!6 = !{!"clang version 3.9.0 (trunk 273572) (llvm/trunk 273585)"}161!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)162!8 = !DISubroutineType(types: !2)163!9 = !DILocation(line: 2, column: 20, scope: !7)164!10 = !DILocation(line: 2, column: 3, scope: !7)165!11 = !DILocation(line: 6, column: 1, scope: !7)166!12 = !DILocation(line: 3, column: 16, scope: !7)167!13 = !{!14, !14, i64 0}168!14 = !{!"omnipotent char", !15, i64 0}169!15 = !{!"Simple C/C++ TBAA"}170!16 = !DILocation(line: 3, column: 23, scope: !7)171!17 = !DILocation(line: 3, column: 21, scope: !7)172!18 = !DILocation(line: 3, column: 5, scope: !7)173!19 = !DILocation(line: 3, column: 14, scope: !7)174!20 = !DILocation(line: 4, column: 12, scope: !7)175!21 = !DILocation(line: 4, column: 19, scope: !7)176!22 = !DILocation(line: 4, column: 17, scope: !7)177!23 = !DILocation(line: 4, column: 5, scope: !7)178!24 = !DILocation(line: 4, column: 10, scope: !7)179!25 = distinct !{!25, !10}180!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)181!27 = !DILocation(line: 9, column: 20, scope: !26)182!28 = !DILocation(line: 9, column: 3, scope: !26)183!29 = !DILocation(line: 13, column: 1, scope: !26)184!30 = !DILocation(line: 10, column: 16, scope: !26)185!31 = !DILocation(line: 10, column: 23, scope: !26)186!32 = !DILocation(line: 10, column: 21, scope: !26)187!33 = !DILocation(line: 10, column: 5, scope: !26)188!34 = !DILocation(line: 10, column: 14, scope: !26)189!35 = !DILocation(line: 11, column: 12, scope: !26)190!36 = !DILocation(line: 11, column: 19, scope: !26)191!37 = !DILocation(line: 11, column: 17, scope: !26)192!38 = !DILocation(line: 11, column: 5, scope: !26)193!39 = !DILocation(line: 11, column: 10, scope: !26)194!40 = distinct !{!40, !28}195!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)196!42 = !DILocation(line: 16, column: 20, scope: !41)197!43 = !DILocation(line: 16, column: 3, scope: !41)198!44 = !DILocation(line: 20, column: 1, scope: !41)199!45 = !DILocation(line: 17, column: 16, scope: !41)200!46 = !DILocation(line: 17, column: 23, scope: !41)201!47 = !DILocation(line: 17, column: 21, scope: !41)202!48 = !DILocation(line: 17, column: 5, scope: !41)203!49 = !DILocation(line: 17, column: 14, scope: !41)204!50 = !DILocation(line: 18, column: 12, scope: !41)205!51 = !DILocation(line: 18, column: 19, scope: !41)206!52 = !DILocation(line: 18, column: 17, scope: !41)207!53 = !DILocation(line: 18, column: 5, scope: !41)208!54 = !DILocation(line: 18, column: 10, scope: !41)209!55 = distinct !{!55, !43}210!56 = !{!"function_entry_count", i64 3}211!57 = !{!"function_entry_count", i64 50}212!58 = !{!"branch_weights", i32 10000, i32 1}213!59 = !{!"branch_weights", i32 1, i32 99}214