Fix Polly
[polly-mirror.git] / test / Isl / CodeGen / single_loop_ll_max_iterations.ll
blob3218de1ab8871a6aecbad5f1c50a133f2f7f61f6
1 ; RUN: opt %loadPolly -polly-ast -analyze  -S < %s | FileCheck %s
3 ;#include "limits.h"
4 ;#define N 20
6 ;int main () {
7 ;  long long i;
8 ;  long long A[N];
10 ;  A[0] = 0;
12 ;  __sync_synchronize();
14 ;  for (i = 0; i < LLONG_MAX; i++)
15 ;    A[0] = i;
17 ;  __sync_synchronize();
19 ;  if (A[0] == LLONG_MAX - 1)
20 ;    return 0;
21 ;  else
22 ;    return 1;
25 target 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"
27 define i32 @main() nounwind {
28 entry:
29   %A = alloca [20 x i64], align 8                 ; <[20 x i64]*> [#uses=3]
30   %arraydecay = getelementptr inbounds [20 x i64], [20 x i64]* %A, i32 0, i32 0 ; <i64*> [#uses=1]
31   %arrayidx = getelementptr inbounds i64, i64* %arraydecay, i64 0 ; <i64*> [#uses=1]
32   store i64 0, i64* %arrayidx
33   fence seq_cst
34   br label %for.cond
36 for.cond:                                         ; preds = %for.inc, %entry
37   %0 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]  ; <i64> [#uses=3]
38   %exitcond = icmp ne i64 %0, 9223372036854775807 ; <i1> [#uses=1]
39   br i1 %exitcond, label %for.body, label %for.end
41 for.body:                                         ; preds = %for.cond
42   %arraydecay2 = getelementptr inbounds [20 x i64], [20 x i64]* %A, i32 0, i32 0 ; <i64*> [#uses=1]
43   %arrayidx3 = getelementptr inbounds i64, i64* %arraydecay2, i64 0 ; <i64*> [#uses=1]
44   store i64 %0, i64* %arrayidx3
45   br label %for.inc
47 for.inc:                                          ; preds = %for.body
48   %inc = add nsw i64 %0, 1                        ; <i64> [#uses=1]
49   br label %for.cond
51 for.end:                                          ; preds = %for.cond
52   fence seq_cst
53   %arraydecay5 = getelementptr inbounds [20 x i64], [20 x i64]* %A, i32 0, i32 0 ; <i64*> [#uses=1]
54   %arrayidx6 = getelementptr inbounds i64, i64* %arraydecay5, i64 0 ; <i64*> [#uses=1]
55   %tmp7 = load i64, i64* %arrayidx6                    ; <i64> [#uses=1]
56   %cmp8 = icmp eq i64 %tmp7, 9223372036854775806  ; <i1> [#uses=1]
57   br i1 %cmp8, label %if.then, label %if.else
59 if.then:                                          ; preds = %for.end
60   br label %return
62 if.else:                                          ; preds = %for.end
63   br label %return
65 return:                                           ; preds = %if.else, %if.then
66   %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.else ] ; <i32> [#uses=1]
67   ret i32 %retval.0
70 ; CHECK: for (int c0 = 0; c0 <= 9223372036854775806; c0 += 1)
71 ; CHECK:   Stmt_for_body(c0);