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