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
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 ; This test makes sure we don't duplicate the loop vectorizer's metadata
7 ; while marking them as already vectorized (by setting width = 1), even
8 ; at lower optimization levels, where no extra cleanup is done
10 ; DEBUGLOC-LABEL: define void @_Z3fooPf(
11 ; Check that the phi to resume the scalar part of the loop
13 define void @_Z3fooPf(ptr %a) {
17 for.body: ; preds = %for.body, %entry
18 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
19 %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv
20 %p = load float, ptr %arrayidx, align 4
21 %mul = fmul float %p, 2.000000e+00
22 store float %mul, ptr %arrayidx, align 4
23 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
24 %exitcond = icmp eq i64 %indvars.iv.next, 1024
25 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
27 ; DEBUGLOC: scalar.ph:
28 ; DEBUGLOC-NEXT: %bc.resume.val = phi {{.*}} !dbg ![[DbgLoc:[0-9]+]]
30 ; DEBUGLOC: ![[DbgLoc]] = !DILocation(line: 2
32 for.end: ; preds = %for.body
37 !1 = !{!"llvm.loop.vectorize.width", i32 4}
38 ; CHECK-NOT: !{metadata !"llvm.loop.vectorize.width", i32 4}
39 ; CHECK: !{!"llvm.loop.isvectorized", i32 1}