brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · fe71b6b Raw
82 lines · plain
1; RUN: opt -S -passes=loop-vectorize -force-vector-width=4 -force-vector-interleave=1 < %s | FileCheck --check-prefix=DBG_VALUE --check-prefix=LOOPVEC_4_1 %s2; RUN: opt -S -passes=loop-vectorize -force-vector-width=2 -force-vector-interleave=3 < %s | FileCheck --check-prefix=DBG_VALUE --check-prefix=LOOPVEC_2_3 %s3; RUN: opt -S -passes=loop-unroll  -unroll-count=5 < %s | FileCheck --check-prefix=DBG_VALUE --check-prefix=LOOPUNROLL_5 %s4; RUN: opt -S -passes=loop-vectorize,loop-unroll -force-vector-width=4 -force-vector-interleave=4 - -unroll-count=2 < %s | FileCheck --check-prefix=DBG_VALUE --check-prefix=LOOPVEC_UNROLL %s5; RUN: opt -S -passes=pseudo-probe,loop-unroll  -unroll-count=5 < %s | FileCheck --check-prefix=PSEUDO_PROBE %s6 7; Test if vectorization/unroll factor is recorded in discriminator.8;9; Original source code:10;  1 int *a;11;  2 int *b;12;  313;  4 void foo() {14;  5   for (int i = 0; i < 4096; i++)15;  6     a[i] += b[i];16;  7 }17 18@a = local_unnamed_addr global ptr null, align 819@b = local_unnamed_addr global ptr null, align 820declare void @llvm.dbg.declare(metadata, metadata, metadata) #121 22define void @_Z3foov() local_unnamed_addr #0 !dbg !6 {23  %1 = load ptr, ptr @b, align 8, !dbg !8, !tbaa !924  %2 = load ptr, ptr @a, align 8, !dbg !13, !tbaa !925  br label %3, !dbg !1426 27; <label>:3:                                      ; preds = %3, %028  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %3 ]29  %4 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv, !dbg !830  %5 = load i32, ptr %4, align 4, !dbg !8, !tbaa !1531  %6 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv, !dbg !1332  %7 = load i32, ptr %6, align 4, !dbg !17, !tbaa !1533  %8 = add nsw i32 %7, %5, !dbg !1734;PSEUDO_PROBE-COUNT-5: call void @llvm.pseudoprobe(i64 6699318081062747564, i64 2, i32 0, i64 -1), !dbg ![[#PROBE:]]35;DBG_VALUE: #dbg_value{{.*}} ![[DBG:[0-9]*]]36  call void @llvm.dbg.value(metadata i32 %8, metadata !22, metadata !DIExpression()), !dbg !1737  store i32 %8, ptr %6, align 4, !dbg !17, !tbaa !1538  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !1839  %exitcond = icmp eq i64 %indvars.iv.next, 4096, !dbg !1940  br i1 %exitcond, label %9, label %3, !dbg !14, !llvm.loop !2041 42; <label>:9:                                      ; preds = %343  ret void, !dbg !2144}45 46;DBG_VALUE: ![[TOP:[0-9]*]] = distinct !DISubprogram(name: "foo"47;LOOPVEC_4_1: discriminator: 1748;LOOPVEC_2_3: discriminator: 2549;LOOPUNROLL_5: discriminator: 2150; When unrolling after loop vectorize, both vec_body and remainder loop51; are unrolled.52;LOOPVEC_UNROLL: discriminator: 38553;LOOPVEC_UNROLL: discriminator: 954;DBG_VALUE: ![[DBG]] = {{.*}}, scope: ![[TOP]]55; Pseudo probe should not have duplication factor assigned.56;PSEUDO_PROBE: ![[TOP:[0-9]*]] = distinct !DISubprogram(name: "foo"57;PSEUDO_PROBE: ![[#PROBE]] = !DILocation(line: 6, column: 13, scope: ![[TOP]])58 59!llvm.dbg.cu = !{!0}60!llvm.module.flags = !{!3, !4}61 62!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, debugInfoForProfiling: true)63!1 = !DIFile(filename: "a.cc", directory: "/")64!3 = !{i32 2, !"Dwarf Version", i32 4}65!4 = !{i32 2, !"Debug Info Version", i32 3}66!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, unit: !0)67!8 = !DILocation(line: 6, column: 13, scope: !6)68!9 = !{!10, !10, i64 0}69!10 = !{!"any pointer", !11, i64 0}70!11 = !{!"omnipotent char", !12, i64 0}71!12 = !{!"Simple C++ TBAA"}72!13 = !DILocation(line: 6, column: 5, scope: !6)73!14 = !DILocation(line: 5, column: 3, scope: !6)74!15 = !{!16, !16, i64 0}75!16 = !{!"int", !11, i64 0}76!17 = !DILocation(line: 6, column: 10, scope: !6)77!18 = !DILocation(line: 5, column: 30, scope: !6)78!19 = !DILocation(line: 5, column: 21, scope: !6)79!20 = distinct !{!20, !14}80!21 = !DILocation(line: 7, column: 1, scope: !6)81!22 = !DILocalVariable(name: "a", arg: 1, scope: !6, file: !1, line: 10)82