52 lines · plain
1; RUN: opt %loadNPMPolly -polly-reschedule=0 -polly-loopfusion-greedy=1 -polly-postopts=0 '-passes=polly-custom<opt-isl>' -polly-print-opt-isl -disable-output < %s | FileCheck %s2; RUN: opt %loadNPMPolly -polly-reschedule=1 -polly-loopfusion-greedy=1 -polly-postopts=0 '-passes=polly-custom<opt-isl>' -polly-print-opt-isl -disable-output < %s | FileCheck %s3 4; This could theoretically be fused by adjusting the offset of the second loop by %k (instead of relying on schedule dimensions).5 6define void @func(i32 %n, ptr noalias nonnull %A, i32 %k) {7entry:8 br label %for19 10for1:11 %j1 = phi i32 [0, %entry], [%j1.inc, %inc1]12 %j1.cmp = icmp slt i32 %j1, %n13 br i1 %j1.cmp, label %body1, label %exit114 15 body1:16 %arrayidx1 = getelementptr inbounds double, ptr %A, i32 %j117 store double 21.0, ptr %arrayidx118 br label %inc119 20inc1:21 %j1.inc = add nuw nsw i32 %j1, 122 br label %for123 24exit1:25 br label %for226 27for2:28 %j2 = phi i32 [0, %exit1], [%j2.inc, %inc2]29 %j2.cmp = icmp slt i32 %j2, %n30 br i1 %j2.cmp, label %body2, label %exit231 32 body2:33 %idx2 = add i32 %j2, %k34 %arrayidx2 = getelementptr inbounds double, ptr %A, i32 %idx235 store double 42.0, ptr %arrayidx236 br label %inc237 38inc2:39 %j2.inc = add nuw nsw i32 %j2, 140 br label %for241 42exit2:43 br label %return44 45return:46 ret void47}48 49 50; CHECK: Calculated schedule:51; CHECK-NEXT: n/a52