1 ; RUN: llc -verify-machineinstrs -mtriple=s390x-ibm-linux -mcpu=z13 -O3 -hoist-const-stores < %s | FileCheck %s
3 @b = dso_local local_unnamed_addr global i32 15, align 4
4 @e = dso_local local_unnamed_addr global i32 -1, align 4
5 @f = common dso_local global i32 0, align 4
6 @g = dso_local local_unnamed_addr global ptr @f, align 8
7 @c = common dso_local local_unnamed_addr global i32 0, align 4
8 @a = common dso_local local_unnamed_addr global [6 x i32] zeroinitializer, align 4
9 @d = common dso_local local_unnamed_addr global i32 0, align 4
10 @h = common dso_local local_unnamed_addr global i32 0, align 4
11 @.str = private unnamed_addr constant [15 x i8] c"checksum = %X\0A\00", align 2
13 ; Function Attrs: nounwind
14 define dso_local signext i32 @main() {
16 %i = alloca i32, align 4
17 %.pr = load i32, ptr @c, align 4, !tbaa !2
18 %cmp6 = icmp slt i32 %.pr, 6
19 br i1 %cmp6, label %for.body.preheader, label %for.end
21 for.body.preheader: ; preds = %entry
22 store i32 5, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !2
23 store i32 6, ptr @c, align 4, !tbaa !2
26 for.end: ; preds = %for.body.preheader, %entry
27 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i)
28 store i32 14, ptr %i, align 4, !tbaa !2
29 %.pr2 = load i32, ptr @d, align 4, !tbaa !2
30 %cmp25 = icmp sgt i32 %.pr2, -1
31 br i1 %cmp25, label %for.cond4thread-pre-split.lr.ph, label %for.end.for.end11_crit_edge
33 for.end.for.end11_crit_edge: ; preds = %for.end
34 %.pre10 = load i32, ptr @b, align 4, !tbaa !2
37 ; CHECK: # %for.cond4thread-pre-split.lr.ph
38 ; CHECK-NOT: mvhi 164(%r15), 0
40 ; CHECK: mvhi 164(%r15), 0
42 for.cond4thread-pre-split.lr.ph: ; preds = %for.end
43 %0 = ptrtoint ptr %i to i64
44 %1 = trunc i64 %0 to i32
45 %2 = load ptr, ptr @g, align 8
46 %.pr3.pre = load i32, ptr @e, align 4, !tbaa !2
47 br label %for.cond4thread-pre-split
49 for.cond4thread-pre-split: ; preds = %for.cond4thread-pre-split.lr.ph, %for.end9
50 %3 = phi i32 [ %.pr2, %for.cond4thread-pre-split.lr.ph ], [ %dec, %for.end9 ]
51 %4 = phi i32 [ 14, %for.cond4thread-pre-split.lr.ph ], [ 0, %for.end9 ]
52 %.pr3 = phi i32 [ %.pr3.pre, %for.cond4thread-pre-split.lr.ph ], [ %.pr37, %for.end9 ]
53 %cmp54 = icmp slt i32 %.pr3, 1
54 br i1 %cmp54, label %for.body6.preheader, label %for.end9
56 for.body6.preheader: ; preds = %for.cond4thread-pre-split
57 store i32 %4, ptr %2, align 4, !tbaa !2
58 %5 = load i32, ptr @e, align 4, !tbaa !2
59 %inc811 = add nsw i32 %5, 1
60 store i32 %inc811, ptr @e, align 4, !tbaa !2
61 %cmp512 = icmp slt i32 %5, 0
62 br i1 %cmp512, label %for.body6.for.body6_crit_edge, label %for.end9.loopexit
64 for.body6.for.body6_crit_edge: ; preds = %for.body6.preheader, %for.body6.for.body6_crit_edge.3
65 %.pre = load i32, ptr %i, align 4, !tbaa !2
66 store i32 %.pre, ptr %2, align 4, !tbaa !2
67 %6 = load i32, ptr @e, align 4, !tbaa !2
68 %inc8 = add nsw i32 %6, 1
69 store i32 %inc8, ptr @e, align 4, !tbaa !2
70 %cmp5 = icmp slt i32 %6, 0
71 br i1 %cmp5, label %for.body6.for.body6_crit_edge.1, label %for.end9.loopexit
73 for.end9.loopexit: ; preds = %for.body6.for.body6_crit_edge, %for.body6.for.body6_crit_edge.1, %for.body6.for.body6_crit_edge.2, %for.body6.for.body6_crit_edge.3, %for.body6.preheader
74 %inc8.lcssa = phi i32 [ %inc811, %for.body6.preheader ], [ %inc8, %for.body6.for.body6_crit_edge ], [ %inc8.1, %for.body6.for.body6_crit_edge.1 ], [ %inc8.2, %for.body6.for.body6_crit_edge.2 ], [ %inc8.3, %for.body6.for.body6_crit_edge.3 ]
75 %.pre9 = load i32, ptr @d, align 4, !tbaa !2
78 for.end9: ; preds = %for.end9.loopexit, %for.cond4thread-pre-split
79 %7 = phi i32 [ %.pre9, %for.end9.loopexit ], [ %3, %for.cond4thread-pre-split ]
80 %.pr37 = phi i32 [ %inc8.lcssa, %for.end9.loopexit ], [ %.pr3, %for.cond4thread-pre-split ]
81 store i32 %1, ptr @h, align 4, !tbaa !2
82 store i32 0, ptr %i, align 4, !tbaa !2
83 %8 = load i32, ptr @b, align 4, !tbaa !2
84 %9 = load i32, ptr @f, align 4, !tbaa !2
86 %idxprom = sext i32 %xor to i64
87 %arrayidx = getelementptr inbounds [6 x i32], ptr @a, i64 0, i64 %idxprom
88 %10 = load i32, ptr %arrayidx, align 4, !tbaa !2
89 store i32 %10, ptr @b, align 4, !tbaa !2
90 %dec = add nsw i32 %7, -1
91 store i32 %dec, ptr @d, align 4, !tbaa !2
92 %cmp2 = icmp sgt i32 %7, 0
93 br i1 %cmp2, label %for.cond4thread-pre-split, label %for.end11
95 for.end11: ; preds = %for.end9, %for.end.for.end11_crit_edge
96 %11 = phi i32 [ %.pre10, %for.end.for.end11_crit_edge ], [ %10, %for.end9 ]
97 %call = call signext i32 (ptr, ...) @printf(ptr @.str, i32 signext %11)
98 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i)
101 for.body6.for.body6_crit_edge.1: ; preds = %for.body6.for.body6_crit_edge
102 %.pre.1 = load i32, ptr %i, align 4, !tbaa !2
103 store i32 %.pre.1, ptr %2, align 4, !tbaa !2
104 %12 = load i32, ptr @e, align 4, !tbaa !2
105 %inc8.1 = add nsw i32 %12, 1
106 store i32 %inc8.1, ptr @e, align 4, !tbaa !2
107 %cmp5.1 = icmp slt i32 %12, 0
108 br i1 %cmp5.1, label %for.body6.for.body6_crit_edge.2, label %for.end9.loopexit
110 for.body6.for.body6_crit_edge.2: ; preds = %for.body6.for.body6_crit_edge.1
111 %.pre.2 = load i32, ptr %i, align 4, !tbaa !2
112 store i32 %.pre.2, ptr %2, align 4, !tbaa !2
113 %13 = load i32, ptr @e, align 4, !tbaa !2
114 %inc8.2 = add nsw i32 %13, 1
115 store i32 %inc8.2, ptr @e, align 4, !tbaa !2
116 %cmp5.2 = icmp slt i32 %13, 0
117 br i1 %cmp5.2, label %for.body6.for.body6_crit_edge.3, label %for.end9.loopexit
119 for.body6.for.body6_crit_edge.3: ; preds = %for.body6.for.body6_crit_edge.2
120 %.pre.3 = load i32, ptr %i, align 4, !tbaa !2
121 store i32 %.pre.3, ptr %2, align 4, !tbaa !2
122 %14 = load i32, ptr @e, align 4, !tbaa !2
123 %inc8.3 = add nsw i32 %14, 1
124 store i32 %inc8.3, ptr @e, align 4, !tbaa !2
125 %cmp5.3 = icmp slt i32 %14, 0
126 br i1 %cmp5.3, label %for.body6.for.body6_crit_edge, label %for.end9.loopexit
129 ; Function Attrs: argmemonly nounwind
130 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
132 ; Function Attrs: argmemonly nounwind
133 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
135 ; Function Attrs: nounwind
136 declare dso_local signext i32 @printf(ptr nocapture readonly, ...)
138 !llvm.module.flags = !{!0}
140 !0 = !{i32 1, !"wchar_size", i32 4}
141 !2 = !{!3, !3, i64 0}
142 !3 = !{!"int", !4, i64 0}
143 !4 = !{!"omnipotent char", !5, i64 0}
144 !5 = !{!"Simple C/C++ TBAA"}