53 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<optree>' -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines2;3; Cannot rematerialize %val from B[0] at bodyC because B[0] has been4; overwritten in bodyB.5;6; for (int j = 0; j < n; j += 1) {7; bodyA:8; double val = B[j];9;10; bodyB:11; B[j] = 0.0;12;13; bodyC:14; A[j] = val;15; }16;17define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {18entry:19 br label %for20 21for:22 %j = phi i32 [0, %entry], [%j.inc, %inc]23 %j.cmp = icmp slt i32 %j, %n24 br i1 %j.cmp, label %bodyA, label %exit25 26 bodyA:27 %B_idx = getelementptr inbounds double, ptr %B, i32 %j28 %val = load double, ptr %B_idx29 br label %bodyB30 31 bodyB:32 store double 0.0, ptr %B_idx33 br label %bodyC34 35 bodyC:36 %A_idx = getelementptr inbounds double, ptr %A, i32 %j37 store double %val, ptr %A_idx38 br label %inc39 40inc:41 %j.inc = add nuw nsw i32 %j, 142 br label %for43 44exit:45 br label %return46 47return:48 ret void49}50 51 52; CHECK: ForwardOpTree executed, but did not modify anything53