Update Polly tests to handle explicitly typed gep changes in LLVM
[polly-mirror.git] / test / Isl / CodeGen / single_loop_ll_max_iterations.ll
blobcb82a72c687cfb83a18c34fa70c1cffbd5c777c8
1 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -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"
26 target triple = "x86_64-unknown-linux-gnu"
28 define i32 @main() nounwind {
29 entry:
30   %A = alloca [20 x i64], align 8                 ; <[20 x i64]*> [#uses=3]
31   %arraydecay = getelementptr inbounds [20 x i64], [20 x i64]* %A, i32 0, i32 0 ; <i64*> [#uses=1]
32   %arrayidx = getelementptr inbounds i64, i64* %arraydecay, i64 0 ; <i64*> [#uses=1]
33   store i64 0, i64* %arrayidx
34   fence seq_cst
35   br label %for.cond
37 for.cond:                                         ; preds = %for.inc, %entry
38   %0 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]  ; <i64> [#uses=3]
39   %exitcond = icmp ne i64 %0, 9223372036854775807 ; <i1> [#uses=1]
40   br i1 %exitcond, label %for.body, label %for.end
42 for.body:                                         ; preds = %for.cond
43   %arraydecay2 = getelementptr inbounds [20 x i64], [20 x i64]* %A, i32 0, i32 0 ; <i64*> [#uses=1]
44   %arrayidx3 = getelementptr inbounds i64, i64* %arraydecay2, i64 0 ; <i64*> [#uses=1]
45   store i64 %0, i64* %arrayidx3
46   br label %for.inc
48 for.inc:                                          ; preds = %for.body
49   %inc = add nsw i64 %0, 1                        ; <i64> [#uses=1]
50   br label %for.cond
52 for.end:                                          ; preds = %for.cond
53   fence seq_cst
54   %arraydecay5 = getelementptr inbounds [20 x i64], [20 x i64]* %A, i32 0, i32 0 ; <i64*> [#uses=1]
55   %arrayidx6 = getelementptr inbounds i64, i64* %arraydecay5, i64 0 ; <i64*> [#uses=1]
56   %tmp7 = load i64* %arrayidx6                    ; <i64> [#uses=1]
57   %cmp8 = icmp eq i64 %tmp7, 9223372036854775806  ; <i1> [#uses=1]
58   br i1 %cmp8, label %if.then, label %if.else
60 if.then:                                          ; preds = %for.end
61   br label %return
63 if.else:                                          ; preds = %for.end
64   br label %return
66 return:                                           ; preds = %if.else, %if.then
67   %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.else ] ; <i32> [#uses=1]
68   ret i32 %retval.0
71 ; CHECK: for (int c0 = 0; c0 <= 9223372036854775806; c0 += 1)
72 ; CHECK:   Stmt_for_body(c0);