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,38 @@ 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+ define void @widen_ptr_induction_dbg (ptr %start , ptr %end ) {
35+ ; DEBUGLOC-LABEL: define void @widen_ptr_induction_dbg(
36+ ; DEBUGLOC: vector.body:
37+ ; DEBUGLOC-NEXT: = phi ptr {{.+}}, !dbg ![[PTRIVLOC:[0-9]+]]
38+ ; DEBUGLOC: = phi i64
39+ ;
40+ ; DEBUGLOC: loop:
41+ ; DEBUGLOC-NEXT: = phi ptr {{.+}}, !dbg ![[PTRIVLOC]]
2942;
30- ; DEBUGLOC: ![[DbgLoc]] = !DILocation(line: 2
43+ entry:
44+ br label %loop
3145
32- for.end: ; preds = %for.body
46+ loop:
47+ %iv = phi ptr [ %start , %entry ], [ %iv.next , %loop ]
48+ %iv.next = getelementptr inbounds ptr , ptr %iv , i64 1
49+ store ptr %iv , ptr %iv , align 1
50+ %cmp.not = icmp eq ptr %iv.next , %end
51+ br i1 %cmp.not , label %exit , label %loop
52+
53+ exit:
3354 ret void
3455}
3556
57+
3658!0 = !{!0 , !1 }
3759!1 = !{!"llvm.loop.vectorize.width" , i32 4 }
3860; CHECK-NOT: !{metadata !"llvm.loop.vectorize.width", i32 4}
3961; CHECK: !{!"llvm.loop.isvectorized", i32 1}
62+
63+ ; DEBUGLOC: ![[RESUMELOC]] = !DILocation(line: 2
64+ ; DEBUGLOC: ![[PTRIVLOC]] = !DILocation(line: 12
0 commit comments