Skip to content

Commit 46298de

Browse files
committed
simplify CFG
1 parent 9adc362 commit 46298de

File tree

1 file changed

+40
-49
lines changed

1 file changed

+40
-49
lines changed

llvm/test/Transforms/LoopVectorize/RISCV/dbg-tail-folding-by-evl.ll

Lines changed: 40 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,27 @@
88

99
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
1010

11-
define void @reverse_store(ptr %a, i32 %n) !dbg !4 {
11+
define void @reverse_store(ptr %a, i64 %n) !dbg !4 {
1212
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
13+
#dbg_value(ptr %a, !11, !DIExpression(), !15)
14+
#dbg_value(i64 %n, !12, !DIExpression(), !15)
15+
#dbg_value(i64 %n, !13, !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value), !16)
16+
br label %for.body, !dbg !17
1817

19-
for.body.preheader: ; preds = %entry
20-
%0 = zext nneg i32 %n to i64, !dbg !19
21-
br label %for.body, !dbg !19
18+
for.cond.cleanup: ; preds = %for.body
19+
ret void, !dbg !18
2220

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
21+
for.body: ; preds = %entry, %for.body
22+
%indvars.iv = phi i64 [ %n, %entry ], [ %indvars.iv.next, %for.body ]
23+
#dbg_value(i64 %indvars.iv, !13, !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value), !16)
24+
%indvars.iv.next = add nsw i64 %indvars.iv, -1, !dbg !20
25+
#dbg_value(i64 %indvars.iv.next, !13, !DIExpression(), !16)
26+
%arrayidx = getelementptr inbounds nuw i32, ptr %a, i64 %indvars.iv.next, !dbg !21
27+
%1 = trunc nuw nsw i64 %indvars.iv.next to i32, !dbg !22
28+
store i32 %1, ptr %arrayidx, align 4, !dbg !22
29+
#dbg_value(i64 %indvars.iv.next, !13, !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value), !16)
30+
%cmp = icmp samesign ugt i64 %indvars.iv, 1, !dbg !23
31+
br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !24, !llvm.loop !25
4032
}
4133

4234
!llvm.dbg.cu = !{!0}
@@ -46,28 +38,27 @@ for.body: ; preds = %for.body.preheader,
4638
!1 = !DIFile(filename: "dbg-tail-folding-by-evl.cpp", directory: "/test/file/path")
4739
!2 = !{i32 2, !"Debug Info Version", i32 3}
4840
!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)
41+
!4 = distinct !DISubprogram(name: "reverse_store", linkageName: "_Z13reverse_storePil", scope: !1, file: !1, line: 1, type: !5, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
5042
!5 = !DISubroutineType(types: !6)
5143
!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}
44+
!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64)
45+
!8 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed)
46+
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
47+
!10 = !{!11, !12, !13}
48+
!11 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 1, type: !7)
49+
!12 = !DILocalVariable(name: "n", arg: 2, scope: !4, file: !1, line: 1, type: !8)
50+
!13 = !DILocalVariable(name: "i", scope: !14, file: !1, line: 2, type: !9)
51+
!14 = distinct !DILexicalBlock(scope: !4, file: !1, line: 2, column: 5)
52+
!15 = !DILocation(line: 0, scope: !4)
53+
!16 = !DILocation(line: 0, scope: !14)
54+
!17 = !DILocation(line: 2, column: 5, scope: !14)
55+
!18 = !DILocation(line: 4, column: 1, scope: !4)
56+
!19 = distinct !DILexicalBlock(scope: !14, file: !1, line: 2, column: 5)
57+
!20 = !DILocation(line: 2, scope: !14)
58+
!21 = !DILocation(line: 3, column: 7, scope: !19)
59+
!22 = !DILocation(line: 3, column: 12, scope: !19)
60+
!23 = !DILocation(line: 2, column: 27, scope: !19)
61+
!24 = !DILocation(line: 2, column: 5, scope: !14)
62+
!25 = distinct !{!25, !17, !26, !27}
63+
!26 = !DILocation(line: 3, column: 14, scope: !14)
64+
!27 = !{!"llvm.loop.vectorize.enable", i1 true}

0 commit comments

Comments
 (0)