70 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly<no-default-opts>' -polly-invariant-load-hoisting=true -polly-process-unprofitable -S < %s | FileCheck %s2;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 i6423;24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"25 26define void @f(ptr %A, ptr %B) {27entry:28 br label %stmt.S29 30stmt.S: ; preds = %do.cond, %entry31 %indvars.iv2 = phi i64 [ %indvars.iv.next3, %do.cond ], [ 0, %entry ]32 %tmp = load i32, ptr %B, align 433 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv234 %tmp4 = load i32, ptr %arrayidx, align 435 %add = add nsw i32 %tmp4, %tmp36 store i32 %add, ptr %arrayidx, align 437 br label %do.cond38 39do.cond: ; preds = %do.body40 %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 141 %exitcond = icmp ne i64 %indvars.iv.next3, 10142 br i1 %exitcond, label %stmt.S, label %do.end43 44do.end: ; preds = %do.cond45 %tmp5 = trunc i64 101 to i3246 call void @fence() #247 %tmp6 = sext i32 %tmp5 to i6448 br label %stmt.P49 50stmt.P: ; preds = %do.cond.5, %do.end51 %indvars.iv = phi i64 [ %indvars.iv.next, %do.cond.5 ], [ %tmp6, %do.end ]52 %arrayidx3 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv53 %tmp7 = load i32, ptr %arrayidx3, align 454 %inc4 = add nsw i32 %tmp7, 155 store i32 %inc4, ptr %arrayidx3, align 456 br label %do.cond.557 58do.cond.5: ; preds = %do.body.159 %div = sdiv i32 %tmp, 260 %tmp8 = sext i32 %div to i6461 %cmp7 = icmp slt i64 %indvars.iv, %tmp862 %indvars.iv.next = add i64 %indvars.iv, 163 br i1 %cmp7, label %stmt.P, label %do.end.864 65do.end.8: ; preds = %do.cond.566 ret void67}68 69declare void @fence()70