93 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<ast>' -polly-print-ast -disable-output < %s | FileCheck %s2 3;#define N 204;#include "limits.h"5;#include <stdio.h>6;int A[N];7;8;void single_do_loop_int_max_iterations() {9; int i;10;11; __sync_synchronize();12;13; i = 0;14;15; do {16; A[0] = i;17; ++i;18; } while (i < INT_MAX);19;20; __sync_synchronize();21;}22;23;int main () {24; int i;25;26; A[0] = 0;27;28; single_do_loop_int_max_iterations();29;30; fprintf(stdout, "Output %d\n", A[0]);31;32; if (A[0] == INT_MAX - 1)33; return 0;34; else35; return 1;36;}37 38target 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"39 40%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }41%struct._IO_marker = type { ptr, ptr, i32 }42 43@A = common global [20 x i32] zeroinitializer, align 4 ; <ptr> [#uses=1]44@stdout = external global ptr ; <ptr> [#uses=1]45@.str = private constant [11 x i8] c"Output %d\0A\00" ; <ptr> [#uses=1]46 47define void @single_do_loop_int_max_iterations() nounwind {48entry:49 fence seq_cst50 br label %do.body51 52do.body: ; preds = %do.cond, %entry53 %0 = phi i32 [ 0, %entry ], [ %inc, %do.cond ] ; <i32> [#uses=2]54 store i32 %0, ptr @A55 %inc = add nsw i32 %0, 1 ; <i32> [#uses=2]56 br label %do.cond57 58do.cond: ; preds = %do.body59 %exitcond = icmp ne i32 %inc, 2147483647 ; <i1> [#uses=1]60 br i1 %exitcond, label %do.body, label %do.end61 62do.end: ; preds = %do.cond63 fence seq_cst64 ret void65}66 67define i32 @main() nounwind {68entry:69 store i32 0, ptr @A70 call void @single_do_loop_int_max_iterations()71 %tmp = load ptr, ptr @stdout ; <ptr> [#uses=1]72 %tmp1 = load i32, ptr @A ; <i32> [#uses=1]73 %call = call i32 (ptr, ptr, ...) @fprintf(ptr %tmp, ptr @.str, i32 %tmp1) ; <i32> [#uses=0]74 %tmp2 = load i32, ptr @A ; <i32> [#uses=1]75 %cmp = icmp eq i32 %tmp2, 2147483646 ; <i1> [#uses=1]76 br i1 %cmp, label %if.then, label %if.else77 78if.then: ; preds = %entry79 br label %return80 81if.else: ; preds = %entry82 br label %return83 84return: ; preds = %if.else, %if.then85 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.else ] ; <i32> [#uses=1]86 ret i32 %retval.087}88 89declare i32 @fprintf(ptr, ptr, ...)90 91; CHECK: for (int c0 = 0; c0 <= 2147483646; c0 += 1)92; CHECK: Stmt_do_body(c0);93