Skip to content

Commit c8a220c

Browse files
committed
Fixup! Update test cases.
Rename preserve-dbg-loc.ll. Add test case for VPWidenIntrinsicRecipe for defalult target in preserve-dbg-loc-and-loop-metadata.ll
1 parent acabfba commit c8a220c

File tree

4 files changed

+66
-40
lines changed

4 files changed

+66
-40
lines changed

llvm/test/Transforms/LoopVectorize/RISCV/preserve-dbg-loc.ll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
; RUN: -mtriple=riscv64 -mattr=+v -riscv-v-vector-bits-max=128 -S < %s 2>&1 | FileCheck --check-prefix=DEBUGLOC %s
55

66
; Testing the debug locations of the generated vector intstruction are same as
7-
; their scalar instruction.
7+
; their scalar counterpart.
88

9+
define void @vp_select(ptr %a, ptr %b, ptr %c, i64 %N) {
910
; DEBUGLOC-LABEL: define void @vp_select(
10-
define void @vp_select(ptr noalias %a, ptr noalias %b, ptr noalias %c, i64 %N) {
1111
; DEBUGLOC: vector.body:
12-
; DEBUGLOC: %[[VPSel:[0-9]+]] = call <vscale x 4 x i32> @llvm.vp.select.nxv4i32(<vscale x 4 x i1> %15, <vscale x 4 x i32> %vp.op.load1, <vscale x 4 x i32> %vp.op, i32 %9), !dbg ![[SelLoc:[0-9]+]]
12+
; DEBUGLOC: = call <vscale x 4 x i32> @llvm.vp.select.nxv4i32(<vscale x 4 x i1> %{{.+}}, <vscale x 4 x i32> %{{.+}}, <vscale x 4 x i32> %{{.+}}, i32 %{{.+}}), !dbg ![[SelLoc:[0-9]+]]
1313
; DEBUGLOC: for.body:
14-
; DEBUGLOC: %cond.p = select i1 %cmp4, i32 %22, i32 %23, !dbg ![[SelLoc]]
14+
; DEBUGLOC: %cond.p = select i1 %cmp4, i32 %{{.*}}, i32 %{{.*}}, !dbg ![[SelLoc]]
15+
;
1516
entry:
1617
br label %for.body
1718

llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
; RUN: opt < %s -passes=loop-vectorize -force-vector-width=4 -S 2>&1 | FileCheck %s
2-
; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -S | FileCheck %s -check-prefix DEBUGLOC
3-
; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -S --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DEBUGLOC
1+
; RUN: opt < %s -passes=loop-vectorize -S 2>&1 | FileCheck %s
2+
; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -S | FileCheck %s -check-prefix DEBUGLOC
3+
; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -S --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DEBUGLOC
44
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
55

66
; This test makes sure we don't duplicate the loop vectorizer's metadata
@@ -54,6 +54,32 @@ exit:
5454
ret void
5555
}
5656

57+
define void @widen_intrinsic_dbg(i64 %n, ptr noalias %y, ptr noalias %x) nounwind uwtable {
58+
; DEBUGLOC-LABEL: define void @widen_intrinsic_dbg(
59+
;
60+
; DEBUGLOC: vector.body:
61+
; DEBUGLOC: = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %{{.+}}), !dbg ![[INTRINSIC_LOC:[0-9]+]]
62+
; DEBUGLOC: for.body:
63+
; DEBUGLOC: %call = tail call float @llvm.sqrt.f32(float %lv) #2, !dbg ![[INTRINSIC_LOC]]
64+
;
65+
entry:
66+
%cmp6 = icmp sgt i64 %n, 0
67+
br i1 %cmp6, label %for.body, label %for.end
68+
69+
for.body:
70+
%iv = phi i64 [ %iv.next, %for.body ], [ 0, %entry ]
71+
%arrayidx = getelementptr inbounds float, ptr %y, i64 %iv
72+
%lv = load float, ptr %arrayidx, align 4
73+
%call = tail call float @llvm.sqrt.f32(float %lv) nounwind readnone
74+
%arrayidx2 = getelementptr inbounds float, ptr %x, i64 %iv
75+
store float %call, ptr %arrayidx2, align 4
76+
%iv.next = add i64 %iv, 1
77+
%exitcond = icmp eq i64 %iv.next, %n
78+
br i1 %exitcond, label %for.end, label %for.body
79+
80+
for.end:
81+
ret void
82+
}
5783

5884
!0 = !{!0, !1}
5985
!1 = !{!"llvm.loop.vectorize.width", i32 4}
@@ -62,3 +88,4 @@ exit:
6288

6389
; DEBUGLOC: ![[RESUMELOC]] = !DILocation(line: 2
6490
; DEBUGLOC: ![[PTRIVLOC]] = !DILocation(line: 12
91+
; DEBUGLOC: ![[INTRINSIC_LOC]] = !DILocation(line: 23
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -prefer-inloop-reductions -S | FileCheck %s -check-prefix DEBUGLOC
2+
3+
; Testing the debug locations of the generated vector intstruction are same as
4+
; their scalar counterpart.
5+
6+
; DEBUGLOC-LABEL: define i32 @reduction_sum(
7+
define i32 @reduction_sum(ptr %A, ptr %B) {
8+
; DEBUGLOC: vector.body:
9+
; DEBUGLOC: %[[VecLoad:.*]] = load <4 x i32>, ptr %2, align 4, !dbg ![[LoadLoc0:[0-9]+]]
10+
; DEBUGLOC: %[[VecRed:.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %wide.load), !dbg ![[RedLoc0:[0-9]+]]
11+
; DEBUGLOC: loop:
12+
; DEBUGLOC: %l3 = load i32, ptr %l2, align 4, !dbg ![[LoadLoc0]]
13+
; DEBUGLOC: %l7 = add i32 %sum.02, %l3, !dbg ![[RedLoc0]]
14+
;
15+
entry:
16+
br label %loop
17+
18+
loop:
19+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
20+
%sum.02 = phi i32 [ 0, %entry ], [ %l7, %loop ]
21+
%l2 = getelementptr inbounds i32, ptr %A, i64 %iv
22+
%l3 = load i32, ptr %l2, align 4
23+
%l7 = add i32 %sum.02, %l3
24+
%iv.next = add i64 %iv, 1
25+
%exitcond = icmp eq i64 %iv.next, 256
26+
br i1 %exitcond, label %exit, label %loop
27+
28+
exit:
29+
%sum.0.lcssa = phi i32 [ %l7, %loop ]
30+
ret i32 %sum.0.lcssa
31+
}

llvm/test/Transforms/LoopVectorize/preserve-dbg-loc.ll

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)