blob: d85f232052a60e0884eb266e08d8e5e659c3e899 [file] [log] [blame]
Andrew Top61a84952019-04-30 15:07:33 -07001; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-dependences -polly-dependences-analysis-type=value-based -polly-dependences-analysis-level=reference-wise -analyze < %s | FileCheck %s --check-prefix=REF
2; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-dependences -polly-dependences-analysis-type=value-based -polly-dependences-analysis-level=access-wise -analyze < %s | FileCheck %s --check-prefix=ACC
3; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-function-dependences -polly-dependences-analysis-type=value-based -polly-dependences-analysis-level=access-wise -analyze < %s | FileCheck %s --check-prefix=ACC
4;
5; REF: RAW dependences:
6; REF-NEXT: [N] -> { Stmt_for_body[i0] -> Stmt_for_body[6 + i0] : 0 <= i0 <= -13 + N; Stmt_for_body[i0] -> Stmt_for_body[4 + i0] : 0 <= i0 <= -11 + N; [Stmt_for_body[i0] -> MemRef_a[]] -> [Stmt_for_body[4 + i0] -> MemRef_a[]] : 0 <= i0 <= -11 + N; [Stmt_for_body[i0] -> MemRef_b[]] -> [Stmt_for_body[6 + i0] -> MemRef_b[]] : 0 <= i0 <= -13 + N }
7; REF-NEXT: WAR dependences:
8; REF-NEXT: { }
9; REF-NEXT: WAW dependences:
10; REF-NEXT: { }
11; REF-NEXT: Reduction dependences:
12; REF-NEXT: { }
13
14; ACC: RAW dependences:
15; ACC-NEXT: [N] -> { Stmt_for_body[i0] -> Stmt_for_body[6 + i0] : 0 <= i0 <= -13 + N; Stmt_for_body[i0] -> Stmt_for_body[4 + i0] : 0 <= i0 <= -11 + N; [Stmt_for_body[i0] -> Stmt_for_body_Write1[]] -> [Stmt_for_body[4 + i0] -> Stmt_for_body_Read0[]] : 0 <= i0 <= -11 + N; [Stmt_for_body[i0] -> Stmt_for_body_Write3[]] -> [Stmt_for_body[6 + i0] -> Stmt_for_body_Read2[]] : 0 <= i0 <= -13 + N }
16
17; ACC-NEXT: WAR dependences:
18; ACC-NEXT: [N] -> { }
19; ACC-NEXT: WAW dependences:
20; ACC-NEXT: [N] -> { }
21; ACC-NEXT: Reduction dependences:
22; ACC-NEXT: [N] -> { }
23
24; void test(char a[], char b[], long N) {
25; for (long i = 6; i < N; ++i) {
26; a[i] = a[i - 4] + i;
27; b[i] = b[i - 6] + i;
28; }
29; }
30
31target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
32target triple = "x86_64-unknown-linux-gnu"
33
34; Function Attrs: nounwind uwtable
35define void @test(i8* %a, i8* %b, i64 %N) #0 {
36entry:
37 br label %for.cond
38
39for.cond: ; preds = %for.inc, %entry
40 %i.0 = phi i64 [ 6, %entry ], [ %inc, %for.inc ]
41 %cmp = icmp slt i64 %i.0, %N
42 br i1 %cmp, label %for.body, label %for.end
43
44for.body: ; preds = %for.cond
45 %sub = sub nsw i64 %i.0, 4
46 %arrayidx = getelementptr inbounds i8, i8* %a, i64 %sub
47 %0 = load i8, i8* %arrayidx, align 1
48 %conv = sext i8 %0 to i64
49 %add = add nsw i64 %conv, %i.0
50 %conv1 = trunc i64 %add to i8
51 %arrayidx2 = getelementptr inbounds i8, i8* %a, i64 %i.0
52 store i8 %conv1, i8* %arrayidx2, align 1
53 %sub3 = sub nsw i64 %i.0, 6
54 %arrayidx4 = getelementptr inbounds i8, i8* %b, i64 %sub3
55 %1 = load i8, i8* %arrayidx4, align 1
56 %conv5 = sext i8 %1 to i64
57 %add6 = add nsw i64 %conv5, %i.0
58 %conv7 = trunc i64 %add6 to i8
59 %arrayidx8 = getelementptr inbounds i8, i8* %b, i64 %i.0
60 store i8 %conv7, i8* %arrayidx8, align 1
61 br label %for.inc
62
63for.inc: ; preds = %for.body
64 %inc = add nsw i64 %i.0, 1
65 br label %for.cond
66
67for.end: ; preds = %for.cond
68 ret void
69}
70
71attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
72
73!llvm.ident = !{!0}
74
75!0 = !{!"clang version 3.9.0 (http://llvm.org/git/clang.git 3d5d4c39659f11dfbe8e11c857cadf5c449b559b) (http://llvm.org/git/llvm.git 801561e2bba12f2aa0285feb1105e110df443761)"}