Mercurial > hg > Members > tobaru > cbc > CbC_llvm
comparison test/Analysis/LoopAccessAnalysis/unsafe-and-rt-checks.ll @ 95:afa8332a0e37
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | 60c9769439b8 |
children | 7d135dc70f03 |
comparison
equal
deleted
inserted
replaced
84:f3e34b893a5f | 95:afa8332a0e37 |
---|---|
1 ; RUN: opt -loop-accesses -analyze < %s | FileCheck %s | 1 ; RUN: opt -loop-accesses -analyze < %s | FileCheck %s |
2 ; RUN: opt -loop-accesses -analyze -debug-only=loop-accesses < %s 2>&1 | FileCheck %s --check-prefix=DEBUG | |
3 ; REQUIRES: asserts | |
4 | 2 |
5 ; Analyze this loop: | 3 ; Analyze this loop: |
6 ; for (i = 0; i < n; i++) | 4 ; for (i = 0; i < n; i++) |
7 ; A[i + 1] = A[i] * B[i] * C[i]; | 5 ; A[i + 1] = A[i] * B[i] * C[i]; |
8 | 6 |
9 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | 7 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
10 target triple = "x86_64-apple-macosx10.10.0" | 8 target triple = "x86_64-apple-macosx10.10.0" |
11 | 9 |
12 ; CHECK: Report: unsafe dependent memory operations in loop | 10 ; CHECK: Report: unsafe dependent memory operations in loop |
13 | 11 ; CHECK-NEXT: Interesting Dependences: |
14 ; DEBUG: LAA: Distance for %loadA = load i16* %arrayidxA, align 2 to store i16 %mul1, i16* %arrayidxA_plus_2, align 2: 2 | 12 ; CHECK-NEXT: Backward: |
15 ; DEBUG-NEXT: LAA: Failure because of Positive distance 2 | 13 ; CHECK-NEXT: %loadA = load i16, i16* %arrayidxA, align 2 -> |
16 | 14 ; CHECK-NEXT: store i16 %mul1, i16* %arrayidxA_plus_2, align 2 |
17 ; CHECK: Run-time memory checks: | 15 ; CHECK: Run-time memory checks: |
18 ; CHECK-NEXT: 0: | 16 ; CHECK-NEXT: 0: |
19 ; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16* %a, i64 %add | 17 ; CHECK-NEXT: Comparing group |
20 ; CHECK-NEXT: %arrayidxB = getelementptr inbounds i16* %b, i64 %storemerge3 | 18 ; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %storemerge3 |
19 ; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add | |
20 ; CHECK-NEXT: Against group | |
21 ; CHECK-NEXT: %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %storemerge3 | |
21 ; CHECK-NEXT: 1: | 22 ; CHECK-NEXT: 1: |
22 ; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16* %a, i64 %add | 23 ; CHECK-NEXT: Comparing group |
23 ; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16* %c, i64 %storemerge3 | 24 ; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %storemerge3 |
25 ; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add | |
26 ; CHECK-NEXT: Against group | |
27 ; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %storemerge3 | |
24 | 28 |
25 @n = global i32 20, align 4 | |
26 @B = common global i16* null, align 8 | 29 @B = common global i16* null, align 8 |
27 @A = common global i16* null, align 8 | 30 @A = common global i16* null, align 8 |
28 @C = common global i16* null, align 8 | 31 @C = common global i16* null, align 8 |
29 | 32 |
30 define void @f() { | 33 define void @f() { |
31 entry: | 34 entry: |
32 %a = load i16** @A, align 8 | 35 %a = load i16*, i16** @A, align 8 |
33 %b = load i16** @B, align 8 | 36 %b = load i16*, i16** @B, align 8 |
34 %c = load i16** @C, align 8 | 37 %c = load i16*, i16** @C, align 8 |
35 br label %for.body | 38 br label %for.body |
36 | 39 |
37 for.body: ; preds = %for.body, %entry | 40 for.body: ; preds = %for.body, %entry |
38 %storemerge3 = phi i64 [ 0, %entry ], [ %add, %for.body ] | 41 %storemerge3 = phi i64 [ 0, %entry ], [ %add, %for.body ] |
39 | 42 |
40 %arrayidxA = getelementptr inbounds i16* %a, i64 %storemerge3 | 43 %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %storemerge3 |
41 %loadA = load i16* %arrayidxA, align 2 | 44 %loadA = load i16, i16* %arrayidxA, align 2 |
42 | 45 |
43 %arrayidxB = getelementptr inbounds i16* %b, i64 %storemerge3 | 46 %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %storemerge3 |
44 %loadB = load i16* %arrayidxB, align 2 | 47 %loadB = load i16, i16* %arrayidxB, align 2 |
45 | 48 |
46 %arrayidxC = getelementptr inbounds i16* %c, i64 %storemerge3 | 49 %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %storemerge3 |
47 %loadC = load i16* %arrayidxC, align 2 | 50 %loadC = load i16, i16* %arrayidxC, align 2 |
48 | 51 |
49 %mul = mul i16 %loadB, %loadA | 52 %mul = mul i16 %loadB, %loadA |
50 %mul1 = mul i16 %mul, %loadC | 53 %mul1 = mul i16 %mul, %loadC |
51 | 54 |
52 %add = add nuw nsw i64 %storemerge3, 1 | 55 %add = add nuw nsw i64 %storemerge3, 1 |
53 %arrayidxA_plus_2 = getelementptr inbounds i16* %a, i64 %add | 56 %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add |
54 store i16 %mul1, i16* %arrayidxA_plus_2, align 2 | 57 store i16 %mul1, i16* %arrayidxA_plus_2, align 2 |
55 | 58 |
56 %exitcond = icmp eq i64 %add, 20 | 59 %exitcond = icmp eq i64 %add, 20 |
57 br i1 %exitcond, label %for.end, label %for.body | 60 br i1 %exitcond, label %for.end, label %for.body |
58 | 61 |