|
| 1 | +; RUN: opt -passes=loop-vectorize \ |
| 2 | +; RUN: -prefer-predicate-over-epilogue=predicate-else-scalar-epilogue \ |
| 3 | +; RUN: -mtriple=riscv64 -mattr=+v -S < %s | FileCheck %s --check-prefix=IF-EVL |
| 4 | + |
| 5 | +; RUN: opt -passes=loop-vectorize \ |
| 6 | +; RUN: -prefer-predicate-over-epilogue=scalar-epilogue \ |
| 7 | +; RUN: -mtriple=riscv64 -mattr=+v -S < %s | FileCheck %s --check-prefix=NO-VP |
| 8 | + |
| 9 | +target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128" |
| 10 | + |
| 11 | +define void @reverse_store(ptr %a, i32 %n) !dbg !4 { |
| 12 | +entry: |
| 13 | + #dbg_value(ptr %a, !10, !DIExpression(), !14) |
| 14 | + #dbg_value(i32 %n, !11, !DIExpression(), !14) |
| 15 | + #dbg_value(i32 %n, !12, !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value), !15) |
| 16 | + %cmp4 = icmp sgt i32 %n, 0, !dbg !16 |
| 17 | + br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup, !dbg !18 |
| 18 | + |
| 19 | +for.body.preheader: ; preds = %entry |
| 20 | + %0 = zext nneg i32 %n to i64, !dbg !19 |
| 21 | + br label %for.body, !dbg !19 |
| 22 | + |
| 23 | +for.cond.cleanup.loopexit: ; preds = %for.body |
| 24 | + br label %for.cond.cleanup, !dbg !20 |
| 25 | + |
| 26 | +for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry |
| 27 | + ret void, !dbg !20 |
| 28 | + |
| 29 | +for.body: ; preds = %for.body.preheader, %for.body |
| 30 | + %indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] |
| 31 | + #dbg_value(i64 %indvars.iv, !12, !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value), !15) |
| 32 | + %indvars.iv.next = add nsw i64 %indvars.iv, -1, !dbg !21 |
| 33 | + #dbg_value(i64 %indvars.iv.next, !12, !DIExpression(), !15) |
| 34 | + %arrayidx = getelementptr inbounds nuw i32, ptr %a, i64 %indvars.iv.next, !dbg !22 |
| 35 | + %1 = trunc nuw nsw i64 %indvars.iv.next to i32, !dbg !23 |
| 36 | + store i32 %1, ptr %arrayidx, align 4, !dbg !23 |
| 37 | + #dbg_value(i64 %indvars.iv.next, !12, !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value), !15) |
| 38 | + %cmp = icmp samesign ugt i64 %indvars.iv, 1, !dbg !24 |
| 39 | + br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !dbg !25, !llvm.loop !26 |
| 40 | +} |
| 41 | + |
| 42 | +!llvm.dbg.cu = !{!0} |
| 43 | +!llvm.module.flags = !{!2, !3} |
| 44 | + |
| 45 | +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) |
| 46 | +!1 = !DIFile(filename: "dbg-tail-folding-by-evl.cpp", directory: "/test/file/path") |
| 47 | +!2 = !{i32 2, !"Debug Info Version", i32 3} |
| 48 | +!3 = !{i32 7, !"debug-info-assignment-tracking", i1 true} |
| 49 | +!4 = distinct !DISubprogram(name: "reverse_store", linkageName: "_Z13reverse_storePii", scope: !1, file: !1, line: 1, type: !5, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !9) |
| 50 | +!5 = !DISubroutineType(types: !6) |
| 51 | +!6 = !{null, !7, !8} |
| 52 | +!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64) |
| 53 | +!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 54 | +!9 = !{!10, !11, !12} |
| 55 | +!10 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 1, type: !7) |
| 56 | +!11 = !DILocalVariable(name: "n", arg: 2, scope: !4, file: !1, line: 1, type: !8) |
| 57 | +!12 = !DILocalVariable(name: "i", scope: !13, file: !1, line: 2, type: !8) |
| 58 | +!13 = distinct !DILexicalBlock(scope: !4, file: !1, line: 2, column: 5) |
| 59 | +!14 = !DILocation(line: 0, scope: !4) |
| 60 | +!15 = !DILocation(line: 0, scope: !13) |
| 61 | +!16 = !DILocation(line: 2, column: 27, scope: !17) |
| 62 | +!17 = distinct !DILexicalBlock(scope: !13, file: !1, line: 2, column: 5) |
| 63 | +!18 = !DILocation(line: 2, column: 5, scope: !13) |
| 64 | +!19 = !DILocation(line: 2, column: 5, scope: !13) |
| 65 | +!20 = !DILocation(line: 4, column: 1, scope: !4) |
| 66 | +!21 = !DILocation(line: 2, scope: !13) |
| 67 | +!22 = !DILocation(line: 3, column: 7, scope: !17) |
| 68 | +!23 = !DILocation(line: 3, column: 12, scope: !17) |
| 69 | +!24 = !DILocation(line: 2, column: 27, scope: !17) |
| 70 | +!25 = !DILocation(line: 2, column: 5, scope: !13) |
| 71 | +!26 = distinct !{!26, !19, !27, !28} |
| 72 | +!27 = !DILocation(line: 3, column: 14, scope: !13) |
| 73 | +!28 = !{!"llvm.loop.vectorize.enable", i1 true} |
0 commit comments