llvm-project
75 строк · 2.0 Кб
1; RUN: opt %loadNPMPolly '-passes=print<polly-ast>' -disable-output < %s | FileCheck %s
2; XFAIL: *
3
4;define N 20
5;#include "limits.h"
6;int A[N];
7;
8;void bar (int n) {
9; int i;
10; __sync_synchronize();
11; i = 0;
12;
13; do {
14; A[0] = i;
15; ++i;
16; } while (i < 2 * n);
17; __sync_synchronize();
18;}
19;
20;int main () {
21; A[0] = 0;
22; bar (N/2);
23;
24; if (A[0] == N - 1 )
25; return 0;
26; else
27; return 1;
28;}
29
30target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
31
32@A = common global [20 x i32] zeroinitializer, align 4 ; <ptr> [#uses=1]
33
34define void @bar(i32 %n) nounwind {
35entry:
36fence seq_cst
37%tmp = mul i32 %n, 2 ; <i32> [#uses=2]
38%tmp1 = icmp sgt i32 %tmp, 1 ; <i1> [#uses=1]
39%smax = select i1 %tmp1, i32 %tmp, i32 1 ; <i32> [#uses=1]
40br label %do.body
41
42do.body: ; preds = %do.cond, %entry
43%0 = phi i32 [ 0, %entry ], [ %inc, %do.cond ] ; <i32> [#uses=2]
44store i32 %0, ptr @A
45%inc = add nsw i32 %0, 1 ; <i32> [#uses=2]
46br label %do.cond
47
48do.cond: ; preds = %do.body
49%exitcond = icmp ne i32 %inc, %smax ; <i1> [#uses=1]
50br i1 %exitcond, label %do.body, label %do.end
51
52do.end: ; preds = %do.cond
53fence seq_cst
54ret void
55}
56
57define i32 @main() nounwind {
58entry:
59store i32 0, ptr @A
60call void @bar(i32 10)
61%tmp = load i32, ptr @A ; <i32> [#uses=1]
62%cmp = icmp eq i32 %tmp, 19 ; <i1> [#uses=1]
63br i1 %cmp, label %if.then, label %if.else
64
65if.then: ; preds = %entry
66br label %return
67
68if.else: ; preds = %entry
69br label %return
70
71return: ; preds = %if.else, %if.then
72%retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.else ] ; <i32> [#uses=1]
73ret i32 %retval.0
74}
75; CHECK: Scop: do.body => do.end
76
77