1 ;RUN: opt < %s -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 -instcombine -S | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 ;; Check consecutive memory access without preceding GEP instruction
7 ; for (int i=0; i<len; i++) {
11 ; CHECK-LABEL: @consecutive_no_gep(
13 ; CHECK: %[[index:.*]] = phi i64 [ 0, %vector.ph ]
14 ; CHECK: getelementptr float, float* %{{.*}}, i64 %[[index]]
15 ; CHECK: load <4 x float>
17 define void @consecutive_no_gep(float* noalias nocapture readonly %from, float* noalias nocapture %to, i32 %len) #0 {
19 %cmp2 = icmp sgt i32 %len, 0
20 br i1 %cmp2, label %for.body.preheader, label %for.end
22 for.body.preheader: ; preds = %entry
25 for.body: ; preds = %for.body.preheader, %for.body
26 %i.05 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
27 %from.addr.04 = phi float* [ %incdec.ptr, %for.body ], [ %from, %for.body.preheader ]
28 %to.addr.03 = phi float* [ %incdec.ptr1, %for.body ], [ %to, %for.body.preheader ]
29 %incdec.ptr = getelementptr inbounds float, float* %from.addr.04, i64 1
30 %val = load float, float* %from.addr.04, align 4
31 %incdec.ptr1 = getelementptr inbounds float, float* %to.addr.03, i64 1
32 store float %val, float* %to.addr.03, align 4
33 %inc = add nsw i32 %i.05, 1
34 %cmp = icmp slt i32 %inc, %len
35 br i1 %cmp, label %for.body, label %for.end.loopexit
37 for.end.loopexit: ; preds = %for.body
40 for.end: ; preds = %for.end.loopexit, %entry