Skip to content

Commit bc23ef3

Browse files
committed
[LV] Add test showing incorrect debug location for scalar casts.
1 parent 9b496de commit bc23ef3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,29 @@ for.end:
8686
ret void
8787
}
8888

89+
define void @scalar_cast_dbg(ptr nocapture %a, i32 %start, i64 %k) {
90+
; DEBUGLOC-LABEL: define void @scalar_cast_dbg(
91+
; DEBUGLOC: = trunc i64 %index to i32, !dbg [[CASTLOC:![0-9]+]]
92+
;
93+
; DEBUGLOC: loop:
94+
; DEBUGLOC-NOT: %trunc.iv = trunc i64 %iv to i32, !dbg [[CASTLOC]]
95+
;
96+
entry:
97+
br label %loop
98+
99+
loop:
100+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
101+
%trunc.iv = trunc i64 %iv to i32
102+
%arrayidx = getelementptr inbounds i32, ptr %a, i32 %trunc.iv
103+
store i32 %trunc.iv, ptr %arrayidx, align 4
104+
%iv.next = add nuw nsw i64 %iv, 1
105+
%exitcond = icmp eq i64 %iv.next, %k
106+
br i1 %exitcond, label %exit, label %loop
107+
108+
exit:
109+
ret void
110+
}
111+
89112
!0 = !{!0, !1}
90113
!1 = !{!"llvm.loop.vectorize.width", i32 4}
91114
; CHECK-NOT: !{metadata !"llvm.loop.vectorize.width", i32 4}

0 commit comments

Comments
 (0)