1 ; RUN: opt %loadPolly -polly-print-scops -disable-output \
2 ; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 %struct.hoge = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [8 x [2 x i32]], [8 x [2 x i32]], [4 x [4 x i32]], i32, i32, i32, i32, [256 x i8], [256 x i8], [256 x i8], [256 x i8], [256 x i8], i32, i32, i32, i32, i32, i32, [500 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [256 x i8], [256 x i8], [256 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [1024 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [256 x i8], [256 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [256 x i8], i32, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, [5 x double], i32, [8 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [6 x double], [6 x double], [256 x i8], i32, i32, i32, i32, [2 x [5 x i32]], [2 x [5 x i32]], i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32 }
9 ; This test case contains a long sequence of branch instructions together with
10 ; function calls that are considered 'error blocks'. We verify that the
11 ; iteration spaces are not overly complicated.
13 ; CHECK: Assumed Context:
14 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { : }
15 ; CHECK: Invalid Context:
16 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { : (tmp27 = 3 and tmp31 <= 143) or (tmp17 < 0 and tmp21 < 0) or (tmp17 < 0 and tmp21 > 0) or (tmp17 > 0 and tmp21 < 0) or (tmp17 > 0 and tmp21 > 0) }
19 ; CHECK-NEXT: Stmt_bb15
20 ; CHECK-NEXT: Domain :=
21 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb15[] };
22 ; CHECK-NEXT: Schedule :=
23 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb15[] -> [0] };
24 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
25 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb15[] -> MemRef_A[0] };
26 ; CHECK-NEXT: Stmt_bb19
27 ; CHECK-NEXT: Domain :=
28 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb19[] : tmp17 < 0 or tmp17 > 0 };
29 ; CHECK-NEXT: Schedule :=
30 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb19[] -> [1] : tmp17 < 0 or tmp17 > 0 };
31 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
32 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb19[] -> MemRef_A[0] };
33 ; CHECK-NEXT: Stmt_bb24
34 ; CHECK-NEXT: Domain :=
35 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb24[] };
36 ; CHECK-NEXT: Schedule :=
37 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb24[] -> [2] };
38 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
39 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb24[] -> MemRef_A[0] };
40 ; CHECK-NEXT: Stmt_bb29
41 ; CHECK-NEXT: Domain :=
42 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb29[] : tmp27 = 3 };
43 ; CHECK-NEXT: Schedule :=
44 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb29[] -> [3] };
45 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
46 ; CHECK-NEXT: [tmp17, tmp21, tmp27, tmp31] -> { Stmt_bb29[] -> MemRef_A[0] };
49 @global = external global [300 x i8], align 16
50 @global1 = external global ptr, align 8
51 @global2 = external unnamed_addr constant [79 x i8], align 1
52 @global3 = external unnamed_addr constant [57 x i8], align 1
54 declare void @widget() #0
56 ; Function Attrs: nounwind
57 declare void @quux(ptr, i64, ptr, ...) #1
59 ; Function Attrs: nounwind uwtable
60 define void @hoge(ptr %A) #2 {
65 %tmp = load ptr, ptr @global1, align 8, !tbaa !1
66 %tmp16 = getelementptr inbounds %struct.hoge, ptr %tmp, i64 0, i32 153
67 store float 1.0, ptr %A
68 %tmp17 = load i32, ptr %tmp16, align 4, !tbaa !5
69 %tmp18 = icmp eq i32 %tmp17, 0
70 br i1 %tmp18, label %bb24, label %bb19
73 %tmp20 = getelementptr inbounds %struct.hoge, ptr %tmp, i64 0, i32 50
74 store float 1.0, ptr %A
75 %tmp21 = load i32, ptr %tmp20, align 8, !tbaa !9
76 %tmp22 = icmp eq i32 %tmp21, 0
77 br i1 %tmp22, label %bb24, label %bb23
80 call void @widget() #3
83 bb24: ; preds = %bb23, %bb19, %bb15
84 %tmp25 = load ptr, ptr @global1, align 8, !tbaa !1
85 store float 1.0, ptr %A
86 %tmp26 = getelementptr inbounds %struct.hoge, ptr %tmp25, i64 0, i32 16
87 %tmp27 = load i32, ptr %tmp26, align 8, !tbaa !10
88 %tmp28 = icmp eq i32 %tmp27, 3
89 br i1 %tmp28, label %bb29, label %bb34
92 store float 1.0, ptr %A
93 %tmp31 = load i32, ptr %tmp25, align 8, !tbaa !11
94 %tmp32 = icmp slt i32 %tmp31, 144
95 br i1 %tmp32, label %bb33, label %bb34
98 call void (ptr, i64, ptr, ...) @quux(ptr @global, i64 300, ptr @global2, i32 144) #3
101 bb34: ; preds = %bb33, %bb29, %bb24
105 attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
106 attributes #1 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
107 attributes #2 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
108 attributes #3 = { nounwind }
112 !0 = !{!"clang version 3.8.0 (trunk 252261) (llvm/trunk 252271)"}
113 !1 = !{!2, !2, i64 0}
114 !2 = !{!"any pointer", !3, i64 0}
115 !3 = !{!"omnipotent char", !4, i64 0}
116 !4 = !{!"Simple C/C++ TBAA"}
117 !5 = !{!6, !7, i64 5100}
118 !6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !7, i64 68, !3, i64 72, !3, i64 136, !3, i64 200, !7, i64 264, !7, i64 268, !7, i64 272, !7, i64 276, !3, i64 280, !3, i64 536, !3, i64 792, !3, i64 1048, !3, i64 1304, !7, i64 1560, !7, i64 1564, !7, i64 1568, !7, i64 1572, !7, i64 1576, !7, i64 1580, !3, i64 1584, !7, i64 2084, !7, i64 2088, !7, i64 2092, !7, i64 2096, !7, i64 2100, !7, i64 2104, !7, i64 2108, !7, i64 2112, !7, i64 2116, !7, i64 2120, !7, i64 2124, !7, i64 2128, !7, i64 2132, !7, i64 2136, !7, i64 2140, !7, i64 2144, !7, i64 2148, !7, i64 2152, !7, i64 2156, !3, i64 2160, !3, i64 2416, !3, i64 2672, !7, i64 2928, !7, i64 2932, !7, i64 2936, !7, i64 2940, !7, i64 2944, !7, i64 2948, !7, i64 2952, !7, i64 2956, !7, i64 2960, !7, i64 2964, !7, i64 2968, !7, i64 2972, !3, i64 2976, !7, i64 4000, !7, i64 4004, !7, i64 4008, !7, i64 4012, !7, i64 4016, !7, i64 4020, !7, i64 4024, !7, i64 4028, !7, i64 4032, !7, i64 4036, !7, i64 4040, !7, i64 4044, !7, i64 4048, !7, i64 4052, !7, i64 4056, !7, i64 4060, !7, i64 4064, !7, i64 4068, !7, i64 4072, !7, i64 4076, !8, i64 4080, !7, i64 4088, !7, i64 4092, !7, i64 4096, !7, i64 4100, !7, i64 4104, !7, i64 4108, !7, i64 4112, !7, i64 4116, !7, i64 4120, !7, i64 4124, !7, i64 4128, !7, i64 4132, !7, i64 4136, !7, i64 4140, !7, i64 4144, !7, i64 4148, !7, i64 4152, !7, i64 4156, !7, i64 4160, !7, i64 4164, !7, i64 4168, !7, i64 4172, !7, i64 4176, !7, i64 4180, !7, i64 4184, !7, i64 4188, !3, i64 4192, !3, i64 4448, !7, i64 4704, !7, i64 4708, !7, i64 4712, !7, i64 4716, !7, i64 4720, !7, i64 4724, !7, i64 4728, !7, i64 4732, !7, i64 4736, !7, i64 4740, !7, i64 4744, !7, i64 4748, !7, i64 4752, !7, i64 4756, !7, i64 4760, !7, i64 4764, !7, i64 4768, !7, i64 4772, !3, i64 4776, !7, i64 5032, !7, i64 5036, !2, i64 5040, !2, i64 5048, !2, i64 5056, !2, i64 5064, !7, i64 5072, !7, i64 5076, !7, i64 5080, !7, i64 5084, !7, i64 5088, !7, i64 5092, !7, i64 5096, !7, i64 5100, !7, i64 5104, !7, i64 5108, !7, i64 5112, !7, i64 5116, !7, i64 5120, !7, i64 5124, !7, i64 5128, !7, i64 5132, !7, i64 5136, !8, i64 5144, !8, i64 5152, !8, i64 5160, !3, i64 5168, !7, i64 5208, !3, i64 5212, !3, i64 5244, !7, i64 5248, !7, i64 5252, !7, i64 5256, !7, i64 5260, !7, i64 5264, !7, i64 5268, !7, i64 5272, !7, i64 5276, !7, i64 5280, !7, i64 5284, !7, i64 5288, !3, i64 5296, !3, i64 5344, !3, i64 5392, !7, i64 5648, !7, i64 5652, !7, i64 5656, !7, i64 5660, !3, i64 5664, !3, i64 5704, !7, i64 5744, !7, i64 5748, !7, i64 5752, !7, i64 5756, !7, i64 5760, !7, i64 5764, !7, i64 5768, !7, i64 5772, !7, i64 5776, !3, i64 5780, !7, i64 5792}
119 !7 = !{!"int", !3, i64 0}
120 !8 = !{!"double", !3, i64 0}
121 !9 = !{!6, !7, i64 2136}
122 !10 = !{!6, !7, i64 64}
123 !11 = !{!6, !7, i64 0}
124 !12 = !{!6, !7, i64 2096}
125 !13 = !{!6, !7, i64 2120}
126 !14 = !{!6, !7, i64 2128}
127 !15 = !{!6, !7, i64 5776}
128 !16 = !{!6, !7, i64 1564}