diff options
Diffstat (limited to 'llvm/test')
9 files changed, 89 insertions, 19 deletions
diff --git a/llvm/test/Transforms/AddDiscriminators/basic.ll b/llvm/test/Transforms/AddDiscriminators/basic.ll index 801eda2b066..a781c0d409b 100644 --- a/llvm/test/Transforms/AddDiscriminators/basic.ll +++ b/llvm/test/Transforms/AddDiscriminators/basic.ll @@ -58,5 +58,5 @@ attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointe ; CHECK: ![[FOO:[0-9]+]] = distinct !DISubprogram(name: "foo" ; CHECK: ![[BLOCK:[0-9]+]] = distinct !DILexicalBlock(scope: ![[FOO]],{{.*}} line: 3) ; CHECK: ![[THEN]] = !DILocation(line: 3, scope: ![[BLOCKFILE:[0-9]+]]) -; CHECK: ![[BLOCKFILE]] = !DILexicalBlockFile(scope: ![[BLOCK]],{{.*}} discriminator: 1) +; CHECK: ![[BLOCKFILE]] = !DILexicalBlockFile(scope: ![[BLOCK]],{{.*}} discriminator: 2) ; CHECK: ![[END]] = !DILocation(line: 4, scope: ![[FOO]]) diff --git a/llvm/test/Transforms/AddDiscriminators/call-nested.ll b/llvm/test/Transforms/AddDiscriminators/call-nested.ll index 481d6f26004..4d5145abafe 100644 --- a/llvm/test/Transforms/AddDiscriminators/call-nested.ll +++ b/llvm/test/Transforms/AddDiscriminators/call-nested.ll @@ -47,4 +47,4 @@ attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no- !14 = !DILocation(line: 4, column: 3, scope: !4) ; CHECK: ![[CALL2]] = !DILocation(line: 4, column: 10, scope: ![[CALL2BLOCK:[0-9]+]]) -; CHECK: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 1) +; CHECK: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 2) diff --git a/llvm/test/Transforms/AddDiscriminators/call.ll b/llvm/test/Transforms/AddDiscriminators/call.ll index 847a6ad4dc3..5365d68eb09 100644 --- a/llvm/test/Transforms/AddDiscriminators/call.ll +++ b/llvm/test/Transforms/AddDiscriminators/call.ll @@ -5,7 +5,7 @@ ; #1 void bar(); ; #2 ; #3 void foo() { -; #4 bar();bar()/*discriminator 1*/;bar()/*discriminator 2*/; +; #4 bar();bar()/*discriminator 2*/;bar()/*discriminator 4*/; ; #5 } ; Function Attrs: uwtable @@ -49,6 +49,6 @@ attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no- !13 = !DILocation(line: 5, column: 1, scope: !4) ; CHECK: ![[CALL1]] = !DILocation(line: 4, column: 9, scope: ![[CALL1BLOCK:[0-9]+]]) -; CHECK: ![[CALL1BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 1) +; CHECK: ![[CALL1BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 2) ; CHECK: ![[CALL2]] = !DILocation(line: 4, column: 15, scope: ![[CALL2BLOCK:[0-9]+]]) -; CHECK: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 2) +; CHECK: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 4) diff --git a/llvm/test/Transforms/AddDiscriminators/diamond.ll b/llvm/test/Transforms/AddDiscriminators/diamond.ll index b3afe728547..307e95f41e1 100644 --- a/llvm/test/Transforms/AddDiscriminators/diamond.ll +++ b/llvm/test/Transforms/AddDiscriminators/diamond.ll @@ -10,7 +10,7 @@ ; #6 } ; bar(5): discriminator 0 -; bar(3): discriminator 1 +; bar(3): discriminator 2 ; Function Attrs: uwtable define void @_Z3fooi(i32 %i) #0 !dbg !4 { @@ -69,4 +69,4 @@ attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no- !20 = !DILocation(line: 6, column: 1, scope: !4) ; CHECK: ![[ELSE]] = !DILocation(line: 5, column: 18, scope: ![[ELSEBLOCK:[0-9]+]]) -; CHECK: ![[ELSEBLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 1) +; CHECK: ![[ELSEBLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 2) diff --git a/llvm/test/Transforms/AddDiscriminators/first-only.ll b/llvm/test/Transforms/AddDiscriminators/first-only.ll index 1bd8dae5d05..dd2117a5b18 100644 --- a/llvm/test/Transforms/AddDiscriminators/first-only.ll +++ b/llvm/test/Transforms/AddDiscriminators/first-only.ll @@ -69,7 +69,7 @@ attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointe !12 = !DILocation(line: 3, scope: !13) !13 = distinct !DILexicalBlock(line: 3, column: 0, file: !1, scope: !11) -; CHECK: !DILexicalBlockFile(scope: ![[BLOCK2:[0-9]+]],{{.*}} discriminator: 1) +; CHECK: !DILexicalBlockFile(scope: ![[BLOCK2:[0-9]+]],{{.*}} discriminator: 2) !14 = !DILocation(line: 4, scope: !13) ; CHECK: ![[BLOCK2]] = distinct !DILexicalBlock(scope: ![[BLOCK1]],{{.*}} line: 3) diff --git a/llvm/test/Transforms/AddDiscriminators/inlined.ll b/llvm/test/Transforms/AddDiscriminators/inlined.ll index 2e8ea97348d..226e903ee21 100644 --- a/llvm/test/Transforms/AddDiscriminators/inlined.ll +++ b/llvm/test/Transforms/AddDiscriminators/inlined.ll @@ -62,8 +62,8 @@ attributes #3 = { nounwind readnone } !12 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, variables: !2) !13 = distinct !DILocation(line: 1, column: 17, scope: !14) ; CHECK: ![[BF:.*]] = !DILexicalBlockFile(scope: ![[LB1:[0-9]+]], -; CHECK-SAME: discriminator: 1) -!14 = !DILexicalBlockFile(scope: !15, file: !1, discriminator: 1) +; CHECK-SAME: discriminator: 2) +!14 = !DILexicalBlockFile(scope: !15, file: !1, discriminator: 2) ; CHECK: ![[LB1]] = distinct !DILexicalBlock(scope: ![[LB2:[0-9]+]], ; CHECK-SAME: line: 1, column: 16) !15 = distinct !DILexicalBlock(scope: !16, file: !1, line: 1, column: 16) diff --git a/llvm/test/Transforms/AddDiscriminators/multiple.ll b/llvm/test/Transforms/AddDiscriminators/multiple.ll index 387689caddf..b4c353cf00f 100644 --- a/llvm/test/Transforms/AddDiscriminators/multiple.ll +++ b/llvm/test/Transforms/AddDiscriminators/multiple.ll @@ -67,6 +67,6 @@ attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointe !12 = !DILocation(line: 4, scope: !4) ; CHECK: ![[THEN]] = !DILocation(line: 3, scope: ![[THENBLOCK:[0-9]+]]) -; CHECK: ![[THENBLOCK]] = !DILexicalBlockFile(scope: ![[SCOPE:[0-9]+]],{{.*}} discriminator: 1) +; CHECK: ![[THENBLOCK]] = !DILexicalBlockFile(scope: ![[SCOPE:[0-9]+]],{{.*}} discriminator: 2) ; CHECK: ![[ELSE]] = !DILocation(line: 3, scope: ![[ELSEBLOCK:[0-9]+]]) -; CHECK: ![[ELSEBLOCK]] = !DILexicalBlockFile(scope: ![[SCOPE]],{{.*}} discriminator: 2) +; CHECK: ![[ELSEBLOCK]] = !DILexicalBlockFile(scope: ![[SCOPE]],{{.*}} discriminator: 4) diff --git a/llvm/test/Transforms/AddDiscriminators/oneline.ll b/llvm/test/Transforms/AddDiscriminators/oneline.ll index aa52ae42ee4..724574a24dd 100644 --- a/llvm/test/Transforms/AddDiscriminators/oneline.ll +++ b/llvm/test/Transforms/AddDiscriminators/oneline.ll @@ -7,9 +7,9 @@ ; #3 } ; i == 3: discriminator 0 -; i == 5: discriminator 1 -; return 100: discriminator 2 -; return 99: discriminator 3 +; i == 5: discriminator 2 +; return 100: discriminator 4 +; return 99: discriminator 6 define i32 @_Z3fooi(i32 %i) #0 !dbg !4 { %1 = alloca i32, align 4 @@ -91,11 +91,11 @@ attributes #1 = { nounwind readnone } ; CHECK: ![[F:.*]] = distinct !DISubprogram(name: "foo", ; CHECK: ![[IF:.*]] = distinct !DILexicalBlock(scope: ![[F]],{{.*}}line: 2, column: 7) ; CHECK: ![[THEN1]] = !DILocation(line: 2, column: 17, scope: ![[THENBLOCK:[0-9]+]]) -; CHECK: ![[THENBLOCK]] = !DILexicalBlockFile(scope: ![[IF]],{{.*}} discriminator: 1) +; CHECK: ![[THENBLOCK]] = !DILexicalBlockFile(scope: ![[IF]],{{.*}} discriminator: 2) ; CHECK: ![[THEN2]] = !DILocation(line: 2, column: 19, scope: ![[THENBLOCK]]) ; CHECK: ![[THEN3]] = !DILocation(line: 2, column: 7, scope: ![[BRBLOCK:[0-9]+]]) -; CHECK: ![[BRBLOCK]] = !DILexicalBlockFile(scope: ![[F]],{{.*}} discriminator: 1) +; CHECK: ![[BRBLOCK]] = !DILexicalBlockFile(scope: ![[F]],{{.*}} discriminator: 2) ; CHECK: ![[ELSE]] = !DILocation(line: 2, column: 25, scope: ![[ELSEBLOCK:[0-9]+]]) -; CHECK: ![[ELSEBLOCK]] = !DILexicalBlockFile(scope: ![[IF]],{{.*}} discriminator: 2) +; CHECK: ![[ELSEBLOCK]] = !DILexicalBlockFile(scope: ![[IF]],{{.*}} discriminator: 4) ; CHECK: ![[COMBINE]] = !DILocation(line: 2, column: 42, scope: ![[COMBINEBLOCK:[0-9]+]]) -; CHECK: ![[COMBINEBLOCK]] = !DILexicalBlockFile(scope: ![[IF]],{{.*}} discriminator: 3) +; CHECK: ![[COMBINEBLOCK]] = !DILexicalBlockFile(scope: ![[IF]],{{.*}} discriminator: 6) diff --git a/llvm/test/Transforms/LoopVectorize/discriminator.ll b/llvm/test/Transforms/LoopVectorize/discriminator.ll new file mode 100644 index 00000000000..b7d34582dbd --- /dev/null +++ b/llvm/test/Transforms/LoopVectorize/discriminator.ll @@ -0,0 +1,70 @@ +; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 < %s | FileCheck --check-prefix=LOOPVEC_4_1 %s +; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-interleave=3 < %s | FileCheck --check-prefix=LOOPVEC_2_3 %s +; RUN: opt -S -loop-unroll -unroll-count=5 < %s | FileCheck --check-prefix=LOOPUNROLL_5 %s +; 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 + +; Test if vectorization/unroll factor is recorded in discriminator. +; +; Original source code: +; 1 int *a; +; 2 int *b; +; 3 +; 4 void foo() { +; 5 for (int i = 0; i < 4096; i++) +; 6 a[i] += b[i]; +; 7 } + +@a = local_unnamed_addr global i32* null, align 8 +@b = local_unnamed_addr global i32* null, align 8 + +define void @_Z3foov() local_unnamed_addr #0 !dbg !6 { + %1 = load i32*, i32** @b, align 8, !dbg !8, !tbaa !9 + %2 = load i32*, i32** @a, align 8, !dbg !13, !tbaa !9 + br label %3, !dbg !14 + +; <label>:3: ; preds = %3, %0 + %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %3 ] + %4 = getelementptr inbounds i32, i32* %1, i64 %indvars.iv, !dbg !8 + %5 = load i32, i32* %4, align 4, !dbg !8, !tbaa !15 + %6 = getelementptr inbounds i32, i32* %2, i64 %indvars.iv, !dbg !13 + %7 = load i32, i32* %6, align 4, !dbg !17, !tbaa !15 + %8 = add nsw i32 %7, %5, !dbg !17 + store i32 %8, i32* %6, align 4, !dbg !17, !tbaa !15 + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !18 + %exitcond = icmp eq i64 %indvars.iv.next, 4096, !dbg !19 + br i1 %exitcond, label %9, label %3, !dbg !14, !llvm.loop !20 + +; <label>:9: ; preds = %3 + ret void, !dbg !21 +} + +;LOOPVEC_4_1: discriminator: 17 +;LOOPVEC_2_3: discriminator: 25 +;LOOPUNROLL_5: discriminator: 21 +; When unrolling after loop vectorize, both vec_body and remainder loop +; are unrolled. +;LOOPVEC_UNROLL: discriminator: 385 +;LOOPVEC_UNROLL: discriminator: 9 + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, debugInfoForProfiling: true) +!1 = !DIFile(filename: "a.cc", directory: "/") +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, unit: !0) +!8 = !DILocation(line: 6, column: 13, scope: !6) +!9 = !{!10, !10, i64 0} +!10 = !{!"any pointer", !11, i64 0} +!11 = !{!"omnipotent char", !12, i64 0} +!12 = !{!"Simple C++ TBAA"} +!13 = !DILocation(line: 6, column: 5, scope: !6) +!14 = !DILocation(line: 5, column: 3, scope: !6) +!15 = !{!16, !16, i64 0} +!16 = !{!"int", !11, i64 0} +!17 = !DILocation(line: 6, column: 10, scope: !6) +!18 = !DILocation(line: 5, column: 30, scope: !6) +!19 = !DILocation(line: 5, column: 21, scope: !6) +!20 = distinct !{!20, !14} +!21 = !DILocation(line: 7, column: 1, scope: !6) |