llvm-project
71 строка · 2.4 Кб
1; RUN: opt %loadNPMPolly '-passes=print<polly-ast>' -disable-output < %s | FileCheck %s
2
3;#define N 20
4;#include "limits.h"
5;
6;int main () {
7; int i;
8; int A[N];
9;
10; A[0] = 0;
11;
12; __sync_synchronize();
13;
14; for (i = 0; i < INT_MAX; i++)
15; A[0] = i;
16;
17; __sync_synchronize();
18;
19; if (A[0] == INT_MAX - 1)
20; return 0;
21; else
22; return 1;
23;}
24
25target 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"
26
27define i32 @main() nounwind {
28entry:
29%A = alloca [20 x i32], align 4 ; <ptr> [#uses=3]
30%arraydecay = getelementptr inbounds [20 x i32], ptr %A, i32 0, i32 0 ; <ptr> [#uses=1]
31%arrayidx = getelementptr inbounds i32, ptr %arraydecay, i64 0 ; <ptr> [#uses=1]
32store i32 0, ptr %arrayidx
33fence seq_cst
34br label %for.cond
35
36for.cond: ; preds = %for.inc, %entry
37%0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] ; <i32> [#uses=3]
38%exitcond = icmp ne i32 %0, 2147483647 ; <i1> [#uses=1]
39br i1 %exitcond, label %for.body, label %for.end
40
41for.body: ; preds = %for.cond
42%arraydecay2 = getelementptr inbounds [20 x i32], ptr %A, i32 0, i32 0 ; <ptr> [#uses=1]
43%arrayidx3 = getelementptr inbounds i32, ptr %arraydecay2, i64 0 ; <ptr> [#uses=1]
44store i32 %0, ptr %arrayidx3
45br label %for.inc
46
47for.inc: ; preds = %for.body
48%inc = add nsw i32 %0, 1 ; <i32> [#uses=1]
49br label %for.cond
50
51for.end: ; preds = %for.cond
52fence seq_cst
53%arraydecay5 = getelementptr inbounds [20 x i32], ptr %A, i32 0, i32 0 ; <ptr> [#uses=1]
54%arrayidx6 = getelementptr inbounds i32, ptr %arraydecay5, i64 0 ; <ptr> [#uses=1]
55%tmp7 = load i32, ptr %arrayidx6 ; <i32> [#uses=1]
56%cmp8 = icmp eq i32 %tmp7, 2147483646 ; <i1> [#uses=1]
57br i1 %cmp8, label %if.then, label %if.else
58
59if.then: ; preds = %for.end
60br label %return
61
62if.else: ; preds = %for.end
63br label %return
64
65return: ; preds = %if.else, %if.then
66%retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.else ] ; <i32> [#uses=1]
67ret i32 %retval.0
68}
69
70; CHECK: for (int c0 = 0; c0 <= 2147483646; c0 += 1)
71; CHECK: Stmt_for_body(c0);
72