1- ; RUN: opt < %s -passes=loop-vectorize -S 2>&1 | FileCheck %s
2- ; RUN: opt < %s -passes=debugify,loop-vectorize -S | FileCheck %s -check-prefix DEBUGLOC
3- ; RUN: opt < %s -passes=debugify,loop-vectorize -S --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DEBUGLOC
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
44target 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
77; while marking them as already vectorized (by setting width = 1), even
88; at lower optimization levels, where no extra cleanup is done
99
10- ; DEBUGLOC-LABEL: define void @_Z3fooPf(
1110; Check that the phi to resume the scalar part of the loop
1211; has Debug Location.
1312define void @_Z3fooPf (ptr %a ) {
13+ ; DEBUGLOC-LABEL: define void @_Z3fooPf(
14+ ; DEBUGLOC: scalar.ph:
15+ ; DEBUGLOC-NEXT: %bc.resume.val = phi {{.*}} !dbg ![[RESUMELOC:[0-9]+]]
16+ ;
1417entry:
1518 br label %for.body
1619
@@ -24,16 +27,35 @@ for.body: ; preds = %for.body, %entry
2427 %exitcond = icmp eq i64 %indvars.iv.next , 1024
2528 br i1 %exitcond , label %for.end , label %for.body , !llvm.loop !0
2629
27- ; DEBUGLOC: scalar.ph:
28- ; DEBUGLOC-NEXT: %bc.resume.val = phi {{.*}} !dbg ![[DbgLoc:[0-9]+]]
30+ for.end: ; preds = %for.body
31+ ret void
32+ }
33+
34+ ; FIXME: Missing debug location for pointer induction in vector loop
35+ define void @widen_ptr_induction_dbg (ptr %start , ptr %end ) {
36+ ; DEBUGLOC-LABEL: define void @widen_ptr_induction_dbg(
37+ ; DEBUGLOC: vector.body:
38+ ; DEBUGLOC-NOT: = phi ptr {{.+}}, !dbg
39+ ; DEBUGLOC: = phi i64
2940;
30- ; DEBUGLOC: ![[DbgLoc]] = !DILocation(line: 2
41+ entry:
42+ br label %loop
3143
32- for.end: ; preds = %for.body
44+ loop:
45+ %iv = phi ptr [ %start , %entry ], [ %iv.next , %loop ]
46+ %iv.next = getelementptr inbounds ptr , ptr %iv , i64 1
47+ store ptr %iv , ptr %iv , align 1
48+ %cmp.not = icmp eq ptr %iv.next , %end
49+ br i1 %cmp.not , label %exit , label %loop
50+
51+ exit:
3352 ret void
3453}
3554
55+
3656!0 = !{!0 , !1 }
3757!1 = !{!"llvm.loop.vectorize.width" , i32 4 }
3858; CHECK-NOT: !{metadata !"llvm.loop.vectorize.width", i32 4}
3959; CHECK: !{!"llvm.loop.isvectorized", i32 1}
60+
61+ ; DEBUGLOC: ![[RESUMELOC]] = !DILocation(line: 2
0 commit comments