1; RUN: opt %loadPolly -polly-opt-isl -polly-opt-fusion=max -polly-vectorizer=stripmine -polly-invariant-load-hoisting -polly-optimized-scops -analyze < %s | FileCheck %s
2;
3; llvm.org/PR46578
4;
5target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6
7%struct.stCfg_Incell_DetailThreshold.2.30.42.62.74.94.122.126.134.166.194.242.338.342.346.350.354.358.496.0.2.9.16.28.36.37.38.39.40.75 = type { [60 x i8]*, [60 x i32]*, [60 x i32]*, [60 x i32]*, [60 x i32]*, [60 x i32]*, [60 x i32]* }
8@ft8006m_g_stCfg_Incell_DetailThreshold = external dso_local local_unnamed_addr global %struct.stCfg_Incell_DetailThreshold.2.30.42.62.74.94.122.126.134.166.194.242.338.342.346.350.354.358.496.0.2.9.16.28.36.37.38.39.40.75, align 8
9declare dso_local i32 @ft8006m_atoi() local_unnamed_addr #0
10
11define void @func() {
12entry:
13  switch i32 undef, label %cleanup [
14    i32 10, label %if.end
15    i32 14, label %if.end
16    i32 16, label %if.end
17  ]
18
19if.end:                                           ; preds = %entry, %entry, %entry
20  %call15 = call i32 @ft8006m_atoi() #1
21  %0 = zext i32 %call15 to i64
22  br label %for.cond
23
24for.cond:                                         ; preds = %for.inc39, %if.end
25  %indvars.iv302 = phi i64 [ %indvars.iv.next303, %for.inc39 ], [ 0, %if.end ]
26  %exitcond304 = icmp eq i64 %indvars.iv302, 60
27  br i1 %exitcond304, label %cleanup, label %for.cond21
28
29for.cond21:                                       ; preds = %for.body23, %for.cond
30  %indvars.iv296 = phi i64 [ %indvars.iv.next297, %for.body23 ], [ 0, %for.cond ]
31  %exitcond298 = icmp eq i64 %indvars.iv296, 60
32  br i1 %exitcond298, label %for.cond28, label %for.body23
33
34for.body23:                                       ; preds = %for.cond21
35  %1 = load [60 x i32]*, [60 x i32]** getelementptr inbounds (%struct.stCfg_Incell_DetailThreshold.2.30.42.62.74.94.122.126.134.166.194.242.338.342.346.350.354.358.496.0.2.9.16.28.36.37.38.39.40.75, %struct.stCfg_Incell_DetailThreshold.2.30.42.62.74.94.122.126.134.166.194.242.338.342.346.350.354.358.496.0.2.9.16.28.36.37.38.39.40.75* @ft8006m_g_stCfg_Incell_DetailThreshold, i64 0, i32 2), align 8
36  %arrayidx25 = getelementptr [60 x i32], [60 x i32]* %1, i64 %indvars.iv302, i64 %indvars.iv296
37  store i32 undef, i32* %arrayidx25, align 4
38  %indvars.iv.next297 = add nuw nsw i64 %indvars.iv296, 1
39  br label %for.cond21
40
41for.cond28:                                       ; preds = %for.body30, %for.cond21
42  %indvars.iv299 = phi i64 [ %indvars.iv.next300, %for.body30 ], [ 0, %for.cond21 ]
43  %exitcond301 = icmp eq i64 %indvars.iv299, 60
44  br i1 %exitcond301, label %for.inc39, label %for.body30
45
46for.body30:                                       ; preds = %for.cond28
47  %2 = load [60 x i32]*, [60 x i32]** getelementptr inbounds (%struct.stCfg_Incell_DetailThreshold.2.30.42.62.74.94.122.126.134.166.194.242.338.342.346.350.354.358.496.0.2.9.16.28.36.37.38.39.40.75, %struct.stCfg_Incell_DetailThreshold.2.30.42.62.74.94.122.126.134.166.194.242.338.342.346.350.354.358.496.0.2.9.16.28.36.37.38.39.40.75* @ft8006m_g_stCfg_Incell_DetailThreshold, i64 0, i32 2), align 8
48  %arrayidx34 = getelementptr [60 x i32], [60 x i32]* %2, i64 %0, i64 %indvars.iv299
49  store i32 undef, i32* %arrayidx34, align 4
50  %indvars.iv.next300 = add nuw nsw i64 %indvars.iv299, 1
51  br label %for.cond28
52
53for.inc39:                                        ; preds = %for.cond28
54  %indvars.iv.next303 = add nuw nsw i64 %indvars.iv302, 1
55  br label %for.cond
56
57cleanup:                                          ; preds = %for.cond, %entry
58  ret void
59}
60
61
62; CHECK-LABEL: Printing analysis 'Polly - Optimize schedule of SCoP' for region: 'for.cond => cleanup' in function 'func':
63; CHECK: Calculated schedule:
64; CHECK: domain: "[call15] -> { Stmt_for_body23[i0, i1] : 0 <= i0 <= 59 and 0 <= i1 <= 59; Stmt_for_body30[i0, i1] : 0 <= i0 <= 59 and 0 <= i1 <= 59 }"
65; CHECK: child:
66; CHECK:   mark: "1st level tiling - Tiles"
67; CHECK:   child:
68; CHECK:     schedule: "[call15] -> [{ Stmt_for_body23[i0, i1] -> [(floor((i0 + i1)/32))]; Stmt_for_body30[i0, i1] -> [(floor((call15 + i1)/32))] }, { Stmt_for_body23[i0, i1] -> [(floor((i0)/32))]; Stmt_for_body30[i0, i1] -> [(floor((i0)/32))] }]"
69; CHECK:     permutable: 1
70; CHECK:     coincident: [ 1, 0 ]
71; CHECK:     child:
72; CHECK:       mark: "1st level tiling - Points"
73; CHECK:       child:
74; CHECK:         schedule: "[call15] -> [{ Stmt_for_body23[i0, i1] -> [(floor((i0 + i1)/4) - 8*floor((i0 + i1)/32))]; Stmt_for_body30[i0, i1] -> [(floor((call15 + i1)/4) - 8*floor((call15 + i1)/32))] }]"
75; CHECK:         permutable: 1
76; CHECK:         coincident: [ 1 ]
77; CHECK:         options: "[call15] -> { atomic[0]; isolate{{\[\[}}i0, i1] -> [i2]] : 0 <= i1 <= 1 and 0 <= i2 <= 7 and call15 - 32i0 <= 4i2 <= 56 + call15 - 32i0 and (call15 >= 120 or i2 < -8i0 + 8i1); isolate{{\[\[}}i0, 0] -> [i2]] : 0 <= i2 <= 7 and ((call15 >= 120 and -8i0 <= i2 <= 21 - 8i0) or (call15 >= 92 and i2 <= 28 - 8i0 and 4i2 >= call15 - 32i0) or (call15 <= 91 and -8i0 <= i2 <= 21 - 8i0) or (92 <= call15 <= 119 and -8i0 <= i2 <= 21 - 8i0) or (call15 <= 91 and 22 - 8i0 <= i2 <= 28 - 8i0 and 4i2 <= 56 + call15 - 32i0) or (call15 <= 119 and i2 >= 29 - 8i0 and call15 - 32i0 <= 4i2 <= 56 + call15 - 32i0)); isolate{{\[\[}}i0, 1] -> [i2]] : i2 >= 0 and 8 - 8i0 <= i2 <= 7 and ((call15 >= 120 and i2 <= 28 - 8i0) or (call15 <= 119 and i2 >= 29 - 8i0 and 4i2 <= 56 + call15 - 32i0) or (call15 <= 119 and i2 <= 28 - 8i0)) }"
78; CHECK:         child:
79; CHECK:           schedule: "[call15] -> [{ Stmt_for_body23[i0, i1] -> [((i0) mod 32)]; Stmt_for_body30[i0, i1] -> [((i0) mod 32)] }]"
80; CHECK:           permutable: 1
81; CHECK:           child:
82; CHECK:             mark: "SIMD"
83; CHECK:             child:
84; CHECK:               sequence:
85; CHECK:               - filter: "[call15] -> { Stmt_for_body23[i0, i1] }"
86; CHECK:                 child:
87; CHECK:                   schedule: "[call15] -> [{ Stmt_for_body23[i0, i1] -> [((i0 + i1) mod 4)]; Stmt_for_body30[i0, i1] -> [((call15 + i1) mod 4)] }]"
88; CHECK:                   permutable: 1
89; CHECK:                   coincident: [ 1 ]
90; CHECK:               - filter: "[call15] -> { Stmt_for_body30[i0, i1] }"
91; CHECK:                 child:
92; CHECK:                   schedule: "[call15] -> [{ Stmt_for_body23[i0, i1] -> [((i0 + i1) mod 4)]; Stmt_for_body30[i0, i1] -> [((call15 + i1) mod 4)] }]"
93; CHECK:                   permutable: 1
94; CHECK:                   coincident: [ 1 ]
95