71 lines · plain
1; RUN: opt < %s -passes=loop-vectorize -mtriple=x86_64-unknown-linux -S -pass-remarks='loop-vectorize' 2>&1 | FileCheck -check-prefix=VECTORIZED %s2; RUN: opt < %s -passes=loop-vectorize -force-vector-width=1 -force-vector-interleave=4 -mtriple=x86_64-unknown-linux -S -pass-remarks='loop-vectorize' 2>&1 | FileCheck -check-prefix=UNROLLED %s3; RUN: opt < %s -passes=loop-vectorize -force-vector-width=1 -force-vector-interleave=1 -mtriple=x86_64-unknown-linux -S -pass-remarks-analysis='loop-vectorize' 2>&1 | FileCheck -check-prefix=NONE %s4 5; VECTORIZED: remark: vectorization-remarks.c:17:8: vectorized loop (vectorization width: 4, interleaved count: 2)6; UNROLLED: remark: vectorization-remarks.c:17:8: interleaved loop (interleaved count: 4)7; NONE: remark: vectorization-remarks.c:17:8: loop not vectorized: vectorization and interleaving are explicitly disabled, or the loop has already been vectorized8 9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"10 11define i32 @foo(i32 %n) #0 !dbg !4 {12entry:13 %diff = alloca i32, align 414 %cb = alloca [16 x i8], align 1615 %cc = alloca [16 x i8], align 1616 store i32 0, ptr %diff, align 4, !tbaa !1117 br label %for.body18 19for.body: ; preds = %for.body, %entry20 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]21 %add8 = phi i32 [ 0, %entry ], [ %add, %for.body ]22 %arrayidx = getelementptr inbounds [16 x i8], ptr %cb, i64 0, i64 %indvars.iv23 %0 = load i8, ptr %arrayidx, align 1, !tbaa !2124 %conv = sext i8 %0 to i3225 %arrayidx2 = getelementptr inbounds [16 x i8], ptr %cc, i64 0, i64 %indvars.iv26 %1 = load i8, ptr %arrayidx2, align 1, !tbaa !2127 %conv3 = sext i8 %1 to i3228 %sub = sub i32 %conv, %conv329 %add = add nsw i32 %sub, %add830 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 131 %exitcond = icmp eq i64 %indvars.iv.next, 1632 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !2533 34for.end: ; preds = %for.body35 store i32 %add, ptr %diff, align 4, !tbaa !1136 call void @ibar(ptr %diff) #237 ret i32 038}39 40declare void @ibar(ptr) #141 42!llvm.module.flags = !{!7, !8}43!llvm.ident = !{!9}44!llvm.dbg.cu = !{!24}45 46!1 = !DIFile(filename: "vectorization-remarks.c", directory: ".")47!2 = !{}48!3 = !{!4}49!4 = distinct !DISubprogram(name: "foo", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !24, scopeLine: 6, file: !1, scope: !5, type: !6, retainedNodes: !2)50!5 = !DIFile(filename: "vectorization-remarks.c", directory: ".")51!6 = !DISubroutineType(types: !2)52!7 = !{i32 2, !"Dwarf Version", i32 4}53!8 = !{i32 1, !"Debug Info Version", i32 3}54!9 = !{!"clang version 3.5.0 "}55!10 = !DILocation(line: 8, column: 3, scope: !4)56!11 = !{!12, !12, i64 0}57!12 = !{!"int", !13, i64 0}58!13 = !{!"omnipotent char", !14, i64 0}59!14 = !{!"Simple C/C++ TBAA"}60!15 = !DILocation(line: 17, column: 8, scope: !16)61!16 = distinct !DILexicalBlock(line: 17, column: 8, file: !1, scope: !17)62!17 = distinct !DILexicalBlock(line: 17, column: 8, file: !1, scope: !18)63!18 = distinct !DILexicalBlock(line: 17, column: 3, file: !1, scope: !4)64!19 = !DILocation(line: 18, column: 5, scope: !20)65!20 = distinct !DILexicalBlock(line: 17, column: 27, file: !1, scope: !18)66!21 = !{!13, !13, i64 0}67!22 = !DILocation(line: 20, column: 3, scope: !4)68!23 = !DILocation(line: 21, column: 3, scope: !4)69!24 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1, emissionKind: NoDebug)70!25 = !{!25, !15}71