1 ; RUN: opt -S -passes=loop-vectorize,instcombine -force-vector-width=4 -force-vector-interleave=1 -enable-interleaved-mem-accesses=true < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 ; Check that the interleaved-mem-access analysis currently does not create an
6 ; interleave group for the access to array 'in' due to the possibly wrapping
7 ; unsigned 'out_ix' index.
9 ; In this test the interleave-group of the loads is not full (has gaps), so
10 ; the wrapping checks are necessary. Here this cannot be done statically so
11 ; runtime checks are needed, but with Assume=false getPtrStride cannot add
12 ; runtime checks and as a result we can't create the interleave-group.
14 ; FIXME: This is currently a missed optimization until we can use Assume=true
15 ; with proper threshold checks. Once we do that the candidate interleave-group
16 ; will not be invalidated by the wrapping checks.
19 ; void test(ptr __restrict__ out, ptr __restrict__ in, size_t size)
21 ; for (size_t out_offset = 0; out_offset < size; ++out_offset)
23 ; float t0 = in[2*out_offset];
24 ; out[out_offset] = t0;
29 ; CHECK-NOT: %wide.vec = load <8 x i32>, ptr {{.*}}, align 4
30 ; CHECK-NOT: shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
32 define void @_Z4testPfS_m(ptr noalias nocapture %out, ptr noalias nocapture readonly %in, i64 %size) local_unnamed_addr {
34 %cmp7 = icmp eq i64 %size, 0
35 br i1 %cmp7, label %for.cond.cleanup, label %for.body.preheader
40 for.cond.cleanup.loopexit:
41 br label %for.cond.cleanup
47 %out_offset.08 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
48 %mul = shl i64 %out_offset.08, 1
49 %arrayidx = getelementptr inbounds float, ptr %in, i64 %mul
50 %0 = load i32, ptr %arrayidx, align 4
51 %arrayidx1 = getelementptr inbounds float, ptr %out, i64 %out_offset.08
52 store i32 %0, ptr %arrayidx1, align 4
53 %inc = add nuw i64 %out_offset.08, 1
54 %exitcond = icmp eq i64 %inc, %size
55 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body