source: icGREP/icgrep-devel/llvm-3.8.0.src/test/Analysis/LoopAccessAnalysis/non-wrapping-pointer.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 1.1 KB
Line 
1; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s
2
3; For this loop:
4;   for (int i = 0; i < n; i++)
5;    A[2 * i] = A[2 * i] + B[i];
6;
7; , SCEV is unable to prove that A[2 * i] does not overflow.  However,
8; analyzing the IR helps us to conclude it and in turn allow dependence
9; analysis.
10
11target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
12
13; CHECK: Memory dependences are safe{{$}}
14
15define void @f(i16* noalias %a,
16               i16* noalias %b, i64 %N) {
17entry:
18  br label %for.body
19
20for.body:                                         ; preds = %for.body, %entry
21  %ind = phi i64 [ 0, %entry ], [ %inc, %for.body ]
22
23  %mul = mul nuw nsw i64 %ind, 2
24
25  %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %mul
26  %loadA = load i16, i16* %arrayidxA, align 2
27
28  %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %ind
29  %loadB = load i16, i16* %arrayidxB, align 2
30
31  %add = mul i16 %loadA, %loadB
32
33  store i16 %add, i16* %arrayidxA, align 2
34
35  %inc = add nuw nsw i64 %ind, 1
36  %exitcond = icmp eq i64 %inc, %N
37  br i1 %exitcond, label %for.end, label %for.body
38
39for.end:                                          ; preds = %for.body
40  ret void
41}
Note: See TracBrowser for help on using the repository browser.