236
|
1 ; RUN: opt %loadPolly -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines
|
150
|
2 ;
|
|
3 ; Do not try to forward %i.trunc, it is not synthesizable in %body.
|
|
4 ;
|
252
|
5 define void @func(i32 %n, ptr noalias nonnull %A) {
|
150
|
6 entry:
|
|
7 br label %for
|
|
8
|
|
9 for:
|
|
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
|
|
14
|
|
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 is
|
|
20 ; 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, 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
|
|
32
|
|
33 body:
|
252
|
34 store i32 %i.trunc, ptr %A
|
150
|
35 br label %inc
|
|
36
|
|
37
|
|
38 inc:
|
|
39 %j.inc = add nuw nsw i32 %j, 1
|
|
40 br label %for
|
|
41
|
|
42 exit:
|
|
43 br label %return
|
|
44
|
|
45 return:
|
|
46 ret void
|
|
47 }
|
|
48
|
|
49
|
|
50 ; CHECK: ForwardOpTree executed, but did not modify anything
|