xref: /llvm-project/polly/test/ScheduleOptimizer/GreedyFuse/fuse-inner.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly -polly-reschedule=0 -polly-loopfusion-greedy=1 -polly-postopts=0 '-passes=print<polly-opt-isl>' -disable-output < %s | FileCheck %s
2; RUN: opt %loadNPMPolly -polly-reschedule=1 -polly-loopfusion-greedy=1 -polly-postopts=0 '-passes=print<polly-opt-isl>' -disable-output < %s | FileCheck %s
3
4define void @func(i32 %n, ptr noalias nonnull %A) {
5entry:
6  br label %outer.for
7
8outer.for:
9  %k = phi i32 [0, %entry], [%k.inc, %outer.inc]
10  %k.cmp = icmp slt i32 %k, %n
11  br i1 %k.cmp, label %for1, label %outer.exit
12
13  for1:
14    %j1 = phi i32 [0, %outer.for], [%j1.inc, %inc1]
15    %j1.cmp = icmp slt i32 %j1, %n
16    br i1 %j1.cmp, label %body1, label %exit1
17
18      body1:
19        %arrayidx1 = getelementptr inbounds  [1024 x double], ptr %A, i32 %k, i32 %j1
20        store double 21.0, ptr %arrayidx1
21        br label %inc1
22
23  inc1:
24    %j1.inc = add nuw nsw i32 %j1, 1
25    br label %for1
26
27  exit1:
28    br label %for2
29
30  for2:
31    %j2 = phi i32 [0, %exit1], [%j2.inc, %inc2]
32    %j2.cmp = icmp slt i32 %j2, %n
33    br i1 %j2.cmp, label %body2, label %exit2
34
35      body2:
36        %arrayidx2 = getelementptr inbounds  [1024 x double], ptr %A, i32 %k, i32 %j2
37        store double 42.0, ptr %arrayidx2
38        br label %inc2
39
40  inc2:
41    %j2.inc = add nuw nsw i32 %j2, 1
42    br label %for2
43
44  exit2:
45    br label %outer.inc
46
47outer.inc:
48  %k.inc = add nuw nsw i32 %k, 1
49  br label %outer.for
50
51outer.exit:
52    br label %return
53
54return:
55  ret void
56}
57
58
59; CHECK:      Calculated schedule:
60; CHECK-NEXT: domain: "[n] -> { Stmt_body2[i0, i1] : 0 <= i0 < n and 0 <= i1 < n; Stmt_body1[i0, i1] : 0 <= i0 < n and 0 <= i1 < n }"
61; CHECK-NEXT: child:
62; CHECK-NEXT:   schedule: "[n] -> [{ Stmt_body2[i0, i1] -> [(i0)]; Stmt_body1[i0, i1] -> [(i0)] }, { Stmt_body2[i0, i1] -> [(i1)]; Stmt_body1[i0, i1] -> [(i1)] }]"
63; CHECK-NEXT:   child:
64; CHECK-NEXT:     sequence:
65; CHECK-NEXT:     - filter: "[n] -> { Stmt_body1[i0, i1] }"
66; CHECK-NEXT:     - filter: "[n] -> { Stmt_body2[i0, i1] }"
67