1 ; RUN: opt -simplifycfg -enable-mssa-loop-dependency -S --preserve-ll-uselistorder %s | FileCheck %s
2 ; REQUIRES: x86-registered-target
4 ; CHECK: uselistorder i16 0, { 3, 2, 4, 1, 5, 0, 6 }
6 ; Note: test was added in an effort to ensure determinism when updating memoryssa. See PR42574.
7 ; If the uselistorder check becomes no longer relevant, the test can be disabled or removed.
9 %rec9 = type { i16, i32, i32 }
11 @a = global [1 x [1 x %rec9]] zeroinitializer
14 br label %..split_crit_edge
16 ..split_crit_edge: ; preds = %0
19 bb4.us4: ; preds = %bb2.split.us32, %bb6.us28
20 %i.4.01.us5 = phi i16 [ %_tmp49.us30, %bb6.us28 ]
21 br label %g.exit4.us21
23 bb1.i.us14: ; preds = %bb4.us4
24 br label %g.exit4.us21
26 g.exit4.us21: ; preds = %bb1.i.us14, %g.exit4.critedge.us9
27 %i.4.02.us22 = phi i16 [ %i.4.01.us5, %bb4.us4 ], [ %i.4.01.us5, %bb1.i.us14 ]
30 bb5.us26: ; preds = %g.exit4.us21
33 bb6.us28: ; preds = %bb5.us26, %g.exit4.us21
34 %i.4.03.us29 = phi i16 [ %i.4.02.us22, %bb5.us26 ], [ %i.4.02.us22, %g.exit4.us21 ]
35 %_tmp49.us30 = add nuw nsw i16 %i.4.03.us29, 1
38 bb4.us.us: ; preds = %bb2.split.us.us, %bb6.us.us
39 %i.4.01.us.us = phi i16 [ %_tmp49.us.us, %bb6.us.us ]
42 bb1.i.us.us: ; preds = %bb4.us.us
43 br label %g.exit4.us.us
45 g.exit4.us.us: ; preds = %bb1.i.us.us, %g.exit4.critedge.us.us
46 %i.4.02.us.us = phi i16 [ %i.4.01.us.us, %bb1.i.us.us ]
49 bb5.us.us: ; preds = %g.exit4.us.us
52 bb6.us.us: ; preds = %bb5.us.us, %g.exit4.us.us
53 %i.4.03.us.us = phi i16 [ %i.4.02.us.us, %bb5.us.us ]
54 %_tmp49.us.us = add nuw nsw i16 %i.4.03.us.us, 1
58 .split: ; preds = %..split_crit_edge
61 bb2: ; preds = %.split, %bb7
62 %h.3.0 = phi i16 [ undef, %.split ], [ %_tmp53, %bb7 ]
63 br label %bb2.bb2.split_crit_edge
65 bb2.bb2.split_crit_edge: ; preds = %bb2
68 bb2.split.us: ; preds = %bb2
71 bb4.us: ; preds = %bb6.us, %bb2.split.us
72 %i.4.01.us = phi i16 [ 0, %bb2.split.us ]
75 g.exit4.critedge.us: ; preds = %bb4.us
78 bb1.i.us: ; preds = %bb4.us
81 g.exit4.us: ; preds = %bb1.i.us, %g.exit4.critedge.us
82 %i.4.02.us = phi i16 [ %i.4.01.us, %g.exit4.critedge.us ], [ %i.4.01.us, %bb1.i.us ]
85 bb5.us: ; preds = %g.exit4.us
88 bb2.split: ; preds = %bb2.bb2.split_crit_edge
91 bb4: ; preds = %bb2.split, %bb6
92 %i.4.01 = phi i16 [ 0, %bb2.split ]
93 %_tmp16 = getelementptr [1 x [1 x %rec9]], [1 x [1 x %rec9]]* @a, i16 0, i16 %h.3.0, i16 %i.4.01, i32 0
94 %_tmp17 = load i16, i16* %_tmp16, align 1
95 br label %g.exit4.critedge
100 g.exit4.critedge: ; preds = %bb4
101 %_tmp28.c = getelementptr [1 x [1 x %rec9]], [1 x [1 x %rec9]]* @a, i16 0, i16 %h.3.0, i16 %i.4.01, i32 1
102 %_tmp29.c = load i32, i32* %_tmp28.c, align 1
103 %_tmp30.c = trunc i32 %_tmp29.c to i16
106 g.exit4: ; preds = %g.exit4.critedge, %bb1.i
107 %i.4.02 = phi i16 [ %i.4.01, %g.exit4.critedge ], [ %i.4.01, %bb1.i ]
108 %_tmp41 = getelementptr [1 x [1 x %rec9]], [1 x [1 x %rec9]]* @a, i16 0, i16 %h.3.0, i16 %i.4.02, i32 2
111 bb5: ; preds = %g.exit4
114 bb6: ; preds = %bb5, %g.exit4
115 %i.4.03 = phi i16 [ %i.4.02, %bb5 ], [ %i.4.02, %g.exit4 ]
116 %_tmp49 = add nuw nsw i16 %i.4.03, 1
119 bb7: ; preds = %bb7.us-lcssa.us, %bb7.us-lcssa
120 %_tmp53 = add nsw i16 %h.3.0, 1