comparison polly/test/MaximalStaticExpansion/working_expansion.ll @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children c4bab56944e8
comparison
equal deleted inserted replaced
147:c2174574ed3a 150:1d019706d866
1 ; RUN: opt %loadPolly -polly-mse -analyze < %s | FileCheck %s
2 ;
3 ; Verify that the accesses are correctly expanded for MemoryKind::Array
4 ;
5 ; Original source code :
6 ;
7 ; #define Ni 2000
8 ; #define Nj 3000
9 ;
10 ; double mse(double A[Ni], double B[Nj]) {
11 ; int i;
12 ; double tmp = 6;
13 ; for (i = 0; i < Ni; i++) {
14 ; for (int j = 0; j<Nj; j++) {
15 ; B[j] = j;
16 ; }
17 ; A[i] = B[i];
18 ; }
19 ; return tmp;
20 ; }
21 ;
22 ; Check if the expanded SAI are created
23 ;
24 ; CHECK: double MemRef_B_Stmt_for_body3_expanded[2000][3000]; // Element size 8
25 ;
26 ; Check if the memory accesses are modified
27 ;
28 ; CHECK: new: { Stmt_for_body3[i0, i1] -> MemRef_B_Stmt_for_body3_expanded[i0, i1] };
29 ; CHECK: new: { Stmt_for_end[i0] -> MemRef_B_Stmt_for_body3_expanded[i0, i0] };
30 ;
31 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
32 target triple = "x86_64-unknown-linux-gnu"
33
34 define double @mse(double* %A, double* %B) {
35 entry:
36 br label %entry.split
37
38 entry.split: ; preds = %entry
39 br label %for.body
40
41 for.body: ; preds = %entry.split, %for.end
42 %indvars.iv3 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next4, %for.end ]
43 br label %for.body3
44
45 for.body3: ; preds = %for.body, %for.body3
46 %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body3 ]
47 %0 = trunc i64 %indvars.iv to i32
48 %conv = sitofp i32 %0 to double
49 %arrayidx = getelementptr inbounds double, double* %B, i64 %indvars.iv
50 store double %conv, double* %arrayidx, align 8
51 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
52 %exitcond = icmp ne i64 %indvars.iv.next, 3000
53 br i1 %exitcond, label %for.body3, label %for.end
54
55 for.end: ; preds = %for.body3
56 %arrayidx5 = getelementptr inbounds double, double* %B, i64 %indvars.iv3
57 %1 = bitcast double* %arrayidx5 to i64*
58 %2 = load i64, i64* %1, align 8
59 %arrayidx7 = getelementptr inbounds double, double* %A, i64 %indvars.iv3
60 %3 = bitcast double* %arrayidx7 to i64*
61 store i64 %2, i64* %3, align 8
62 %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
63 %exitcond5 = icmp ne i64 %indvars.iv.next4, 2000
64 br i1 %exitcond5, label %for.body, label %for.end10
65
66 for.end10: ; preds = %for.end
67 ret double 6.000000e+00
68 }