51 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<optree>' -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines2;3; Do not try to forward %i.trunc, it is not synthesizable in %body.4;5define void @func(i32 %n, ptr noalias nonnull %A) {6entry:7 br label %for8 9for:10 %j = phi i32 [0, %entry], [%j.inc, %inc]11 %j.cmp = icmp slt i32 %j, %n12 %zero = sext i32 0 to i6413 br i1 %j.cmp, label %inner.for, label %exit14 15 16 ; This loop has some unusual properties:17 ; * It has a known iteration count (8), therefore SCoP-compatible.18 ; * %i.trunc is synthesizable within the loop ({1,+,1}<%while.body>).19 ; * %i.trunc is not synthesizable outside of the loop, because its value is20 ; unknown when exiting.21 ; (should be 8, but ScalarEvolution currently seems unable to derive that)22 ;23 ; ScalarEvolution currently seems to not able to handle the %zero.24 ; If it becomes more intelligent, there might be other such loop constructs.25 inner.for:26 %i = phi i64 [%zero, %for], [%i.inc, %inner.for]27 %i.inc = add nuw nsw i64 %i, 128 %i.trunc = trunc i64 %i.inc to i3229 %i.and = and i32 %i.trunc, 730 %inner.cond = icmp eq i32 %i.and, 031 br i1 %inner.cond, label %body, label %inner.for32 33 body:34 store i32 %i.trunc, ptr %A35 br label %inc36 37 38inc:39 %j.inc = add nuw nsw i32 %j, 140 br label %for41 42exit:43 br label %return44 45return:46 ret void47}48 49 50; CHECK: ForwardOpTree executed, but did not modify anything51