1 ; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s 2 3 ; In: 4 ; 5 ; store_ptr = A; 6 ; load_ptr = &A[2]; 7 ; for (i = 0; i < n; i++) 8 ; *store_ptr++ = *load_ptr++ *10; // A[i] = A[i+2] * 10 9 ; 10 ; make sure, we look through the PHI to conclude that store_ptr and load_ptr 11 ; both have A as their underlying object. The dependence is safe for 12 ; vectorization requiring no memchecks. 13 ; 14 ; Otherwise we would try to prove independence with a memcheck that is going 15 ; to always fail. 16 17 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 18 target triple = "x86_64-apple-macosx10.10.0" 19 20 ; CHECK: Memory dependences are safe{{$}} 21 22 define void @f(i8* noalias %A, i64 %width) { 23 for.body.preheader: 24 %A_ahead = getelementptr inbounds i8, i8* %A, i64 2 25 br label %for.body 26 27 for.body: 28 %i = phi i64 [ %i.1, %for.body ], [ 0, %for.body.preheader ] 29 %load_ptr = phi i8* [ %load_ptr.1, %for.body ], [ %A_ahead, %for.body.preheader ] 30 %store_ptr = phi i8* [ %store_ptr.1, %for.body ], [ %A, %for.body.preheader ] 31 32 %loadA = load i8, i8* %load_ptr, align 1 33 34 %mul = mul i8 %loadA, 10 35 36 store i8 %mul, i8* %store_ptr, align 1 37 38 %load_ptr.1 = getelementptr inbounds i8, i8* %load_ptr, i64 1 39 %store_ptr.1 = getelementptr inbounds i8, i8* %store_ptr, i64 1 40 %i.1 = add nuw i64 %i, 1 41 42 %exitcond = icmp eq i64 %i.1, %width 43 br i1 %exitcond, label %for.end, label %for.body 44 45 for.end: 46 ret void 47 } 48