1; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 < %s | FileCheck --check-prefix=LOOPVEC_4_1 %s 2; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-interleave=3 < %s | FileCheck --check-prefix=LOOPVEC_2_3 %s 3; RUN: opt -S -loop-unroll -unroll-count=5 < %s | FileCheck --check-prefix=LOOPUNROLL_5 %s 4; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-interleave=4 -loop-unroll -unroll-count=2 < %s | FileCheck --check-prefix=LOOPVEC_UNROLL %s 5 6; Test if vectorization/unroll factor is recorded in discriminator. 7; 8; Original source code: 9; 1 int *a; 10; 2 int *b; 11; 3 12; 4 void foo() { 13; 5 for (int i = 0; i < 4096; i++) 14; 6 a[i] += b[i]; 15; 7 } 16 17@a = local_unnamed_addr global i32* null, align 8 18@b = local_unnamed_addr global i32* null, align 8 19 20define void @_Z3foov() local_unnamed_addr #0 !dbg !6 { 21 %1 = load i32*, i32** @b, align 8, !dbg !8, !tbaa !9 22 %2 = load i32*, i32** @a, align 8, !dbg !13, !tbaa !9 23 br label %3, !dbg !14 24 25; <label>:3: ; preds = %3, %0 26 %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %3 ] 27 %4 = getelementptr inbounds i32, i32* %1, i64 %indvars.iv, !dbg !8 28 %5 = load i32, i32* %4, align 4, !dbg !8, !tbaa !15 29 %6 = getelementptr inbounds i32, i32* %2, i64 %indvars.iv, !dbg !13 30 %7 = load i32, i32* %6, align 4, !dbg !17, !tbaa !15 31 %8 = add nsw i32 %7, %5, !dbg !17 32 store i32 %8, i32* %6, align 4, !dbg !17, !tbaa !15 33 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !18 34 %exitcond = icmp eq i64 %indvars.iv.next, 4096, !dbg !19 35 br i1 %exitcond, label %9, label %3, !dbg !14, !llvm.loop !20 36 37; <label>:9: ; preds = %3 38 ret void, !dbg !21 39} 40 41;LOOPVEC_4_1: discriminator: 17 42;LOOPVEC_2_3: discriminator: 25 43;LOOPUNROLL_5: discriminator: 21 44; When unrolling after loop vectorize, both vec_body and remainder loop 45; are unrolled. 46;LOOPVEC_UNROLL: discriminator: 385 47;LOOPVEC_UNROLL: discriminator: 9 48 49!llvm.dbg.cu = !{!0} 50!llvm.module.flags = !{!3, !4} 51 52!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, debugInfoForProfiling: true) 53!1 = !DIFile(filename: "a.cc", directory: "/") 54!3 = !{i32 2, !"Dwarf Version", i32 4} 55!4 = !{i32 2, !"Debug Info Version", i32 3} 56!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, unit: !0) 57!8 = !DILocation(line: 6, column: 13, scope: !6) 58!9 = !{!10, !10, i64 0} 59!10 = !{!"any pointer", !11, i64 0} 60!11 = !{!"omnipotent char", !12, i64 0} 61!12 = !{!"Simple C++ TBAA"} 62!13 = !DILocation(line: 6, column: 5, scope: !6) 63!14 = !DILocation(line: 5, column: 3, scope: !6) 64!15 = !{!16, !16, i64 0} 65!16 = !{!"int", !11, i64 0} 66!17 = !DILocation(line: 6, column: 10, scope: !6) 67!18 = !DILocation(line: 5, column: 30, scope: !6) 68!19 = !DILocation(line: 5, column: 21, scope: !6) 69!20 = distinct !{!20, !14} 70!21 = !DILocation(line: 7, column: 1, scope: !6) 71