1 ; RUN: opt < %s -passes=loop-vectorize -mtriple x86_64 -debug -disable-output 2>&1 | FileCheck %s
4 ; Check that cost model is not executed twice for VF=2 when vectorization is
5 ; forced for a particular loop.
7 ; CHECK: Cost of {{.*}} for VF 2: WIDEN {{.*}} = load
8 ; CHECK: Cost of {{.*}} for VF 2: WIDEN store
9 ; CHECK-NOT: Cost of {{.*}} for VF 2: WIDEN {{.*}} = load
10 ; CHECK-NOT: Cost of {{.*}} for VF 2: WIDEN store
11 ; CHECK: Cost for VF 2: 5 (Estimated cost per lane: 2.
13 define i32 @foo(ptr %A, i32 %n) {
15 %cmp3.i = icmp eq i32 %n, 0
16 br i1 %cmp3.i, label %exit, label %for.body.i
19 %iv = phi i32 [ %add.i, %for.body.i ], [ 0, %entry ]
20 %ld_addr = getelementptr inbounds i32, ptr %A, i32 %iv
21 %0 = load i32, ptr %ld_addr, align 4
23 store i32 %val, ptr %ld_addr, align 4
24 %add.i = add nsw i32 %iv, 1
25 %cmp.i = icmp eq i32 %add.i, %n
26 br i1 %cmp.i, label %exit, label %for.body.i, !llvm.loop !0
29 %__init.addr.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %for.body.i ]
30 ret i32 %__init.addr.0.lcssa.i
34 !1 = !{!"llvm.loop.vectorize.enable", i1 true}