[LAA] Revert a small part of r239295
[oota-llvm.git] / test / Analysis / LoopAccessAnalysis / pointer-with-unknown-bounds.ll
1 ; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
2
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4
5 ; We shouldn't quit the analysis if we encounter a pointer without known
6 ; bounds *unless* we actually need to emit a memcheck for it.  (We only
7 ; compute bounds for SCEVAddRecs so A[i*I] is deemed not having known bounds.)
8 ;
9 ; for (i = 0; i < 20; ++i)
10 ;   A[i*i] *= 2;
11
12 ; CHECK: for.body:
13 ; CHECK:     Report: unsafe dependent memory operations in loop
14 ; CHECK-NOT: Report: cannot identify array bounds
15 ; CHECK:     Interesting Dependences:
16 ; CHECK:       Unknown:
17 ; CHECK:           %loadA = load i16, i16* %arrayidxA, align 2 ->
18 ; CHECK:           store i16 %mul, i16* %arrayidxA, align 2
19
20 define void @f(i16* %a) {
21 entry:
22   br label %for.body
23
24 for.body:                                         ; preds = %for.body, %entry
25   %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
26
27   %access_ind = mul i64 %ind, %ind
28
29   %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %access_ind
30   %loadA = load i16, i16* %arrayidxA, align 2
31
32   %mul = mul i16 %loadA, 2
33
34   store i16 %mul, i16* %arrayidxA, align 2
35
36   %add = add nuw nsw i64 %ind, 1
37   %exitcond = icmp eq i64 %add, 20
38   br i1 %exitcond, label %for.end, label %for.body
39
40 for.end:                                          ; preds = %for.body
41   ret void
42 }