1 ; RUN: opt %loadNPMPolly '-passes=print<polly-optree>' -disable-output < %s | FileCheck %s -match-full-lines
3 ; Do not try to forward %i.trunc, it is not synthesizable in %body.
5 define void @func(i32 %n, ptr noalias nonnull %A) {
10 %j = phi i32 [0, %entry], [%j.inc, %inc]
11 %j.cmp = icmp slt i32 %j, %n
12 %zero = sext i32 0 to i64
13 br i1 %j.cmp, label %inner.for, label %exit
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 is
20 ; unknown when exiting.
21 ; (should be 8, but ScalarEvolution currently seems unable to derive that)
23 ; ScalarEvolution currently seems to not able to handle the %zero.
24 ; If it becomes more intelligent, there might be other such loop constructs.
26 %i = phi i64 [%zero, %for], [%i.inc, %inner.for]
27 %i.inc = add nuw nsw i64 %i, 1
28 %i.trunc = trunc i64 %i.inc to i32
29 %i.and = and i32 %i.trunc, 7
30 %inner.cond = icmp eq i32 %i.and, 0
31 br i1 %inner.cond, label %body, label %inner.for
34 store i32 %i.trunc, ptr %A
39 %j.inc = add nuw nsw i32 %j, 1
50 ; CHECK: ForwardOpTree executed, but did not modify anything