Revert 240130, it caused crashes (repro in PR23900).
[oota-llvm.git] / test / Analysis / LoopAccessAnalysis / number-of-memchecks.ll
1 ; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
2
3 ; 3 reads and 3 writes should need 12 memchecks
4
5 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
6 target triple = "aarch64--linux-gnueabi"
7
8 ; CHECK: Memory dependences are safe with run-time checks
9 ; Memory dependecies have labels starting from 0, so in
10 ; order to verify that we have n checks, we look for
11 ; (n-1): and not n:.
12
13 ; CHECK: Run-time memory checks:
14 ; CHECK-NEXT: 0:
15 ; CHECK: 11:
16 ; CHECK-NOT: 12:
17
18 define void @testf(i16* %a,
19                i16* %b,
20                i16* %c,
21                i16* %d,
22                i16* %e,
23                i16* %f) {
24 entry:
25   br label %for.body
26
27 for.body:                                         ; preds = %for.body, %entry
28   %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
29
30   %add = add nuw nsw i64 %ind, 1
31
32   %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %ind
33   %loadA = load i16, i16* %arrayidxA, align 2
34
35   %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %ind
36   %loadB = load i16, i16* %arrayidxB, align 2
37
38   %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %ind
39   %loadC = load i16, i16* %arrayidxC, align 2
40
41   %mul = mul i16 %loadB, %loadA
42   %mul1 = mul i16 %mul, %loadC
43
44   %arrayidxD = getelementptr inbounds i16, i16* %d, i64 %ind
45   store i16 %mul1, i16* %arrayidxD, align 2
46
47   %arrayidxE = getelementptr inbounds i16, i16* %e, i64 %ind
48   store i16 %mul, i16* %arrayidxE, align 2
49
50   %arrayidxF = getelementptr inbounds i16, i16* %f, i64 %ind
51   store i16 %mul1, i16* %arrayidxF, align 2
52
53   %exitcond = icmp eq i64 %add, 20
54   br i1 %exitcond, label %for.end, label %for.body
55
56 for.end:                                          ; preds = %for.body
57   ret void
58 }