1; RUN: opt %loadPolly -polly-codegen -polly-invariant-load-hoisting=true -polly-process-unprofitable -S < %s | FileCheck %s 2; 3; void fence(void); 4; 5; void f(int *A, int *B) { 6; int i = 0; 7; int x = 0; 8; 9; do { 10; x = *B; 11; S: A[i] += x; 12; } while (i++ < 100); 13; 14; fence(); 15; 16; do { 17; P: A[i]++; 18; } while (i++ < x / 2); 19; } 20; 21; CHECK: polly.stmt.stmt.P: 22; CHECK: sext i32 %tmp.merge to i64 23; 24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 25 26define void @f(i32* %A, i32* %B) { 27entry: 28 br label %stmt.S 29 30stmt.S: ; preds = %do.cond, %entry 31 %indvars.iv2 = phi i64 [ %indvars.iv.next3, %do.cond ], [ 0, %entry ] 32 %tmp = load i32, i32* %B, align 4 33 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv2 34 %tmp4 = load i32, i32* %arrayidx, align 4 35 %add = add nsw i32 %tmp4, %tmp 36 store i32 %add, i32* %arrayidx, align 4 37 br label %do.cond 38 39do.cond: ; preds = %do.body 40 %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 1 41 %exitcond = icmp ne i64 %indvars.iv.next3, 101 42 br i1 %exitcond, label %stmt.S, label %do.end 43 44do.end: ; preds = %do.cond 45 %tmp5 = trunc i64 101 to i32 46 call void @fence() #2 47 %tmp6 = sext i32 %tmp5 to i64 48 br label %stmt.P 49 50stmt.P: ; preds = %do.cond.5, %do.end 51 %indvars.iv = phi i64 [ %indvars.iv.next, %do.cond.5 ], [ %tmp6, %do.end ] 52 %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 53 %tmp7 = load i32, i32* %arrayidx3, align 4 54 %inc4 = add nsw i32 %tmp7, 1 55 store i32 %inc4, i32* %arrayidx3, align 4 56 br label %do.cond.5 57 58do.cond.5: ; preds = %do.body.1 59 %div = sdiv i32 %tmp, 2 60 %tmp8 = sext i32 %div to i64 61 %cmp7 = icmp slt i64 %indvars.iv, %tmp8 62 %indvars.iv.next = add i64 %indvars.iv, 1 63 br i1 %cmp7, label %stmt.P, label %do.end.8 64 65do.end.8: ; preds = %do.cond.5 66 ret void 67} 68 69declare void @fence() 70