1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s
4 @_MergedGlobals = external dso_local global <{ i32, i32 }>, align 4
6 define dso_local i32 @f(i1 %a, i8 %b) local_unnamed_addr {
9 ; CHECK-NEXT: br label [[BB10:%.*]]
11 ; CHECK-NEXT: br i1 [[A:%.*]], label [[BB2:%.*]], label [[BB10]]
13 ; CHECK-NEXT: [[I:%.*]] = phi ptr [ getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1), [[BB1:%.*]] ], [ [[I20:%.*]], [[BB18:%.*]] ]
14 ; CHECK-NEXT: [[I3:%.*]] = phi ptr [ getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1), [[BB1]] ], [ [[I19:%.*]], [[BB18]] ]
15 ; CHECK-NEXT: ret i32 0
17 ; CHECK-NEXT: br label [[BB10]]
19 ; CHECK-NEXT: [[I11:%.*]] = phi ptr [ @_MergedGlobals, [[BB:%.*]] ], [ [[I]], [[BB4:%.*]] ], [ getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1), [[BB1]] ]
20 ; CHECK-NEXT: [[I12:%.*]] = phi ptr [ @_MergedGlobals, [[BB]] ], [ [[I3]], [[BB4]] ], [ getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1), [[BB1]] ]
21 ; CHECK-NEXT: br label [[BB13:%.*]]
23 ; CHECK-NEXT: [[I14:%.*]] = phi ptr [ [[I20]], [[BB18]] ], [ [[I11]], [[BB10]] ]
24 ; CHECK-NEXT: [[I15:%.*]] = phi ptr [ [[I20]], [[BB18]] ], [ [[I12]], [[BB10]] ]
25 ; CHECK-NEXT: [[I16:%.*]] = phi ptr [ [[I19]], [[BB18]] ], [ [[I12]], [[BB10]] ]
26 ; CHECK-NEXT: br i1 [[A]], label [[BB18]], label [[BB17:%.*]]
28 ; CHECK-NEXT: store i32 5, ptr [[I15]], align 4
29 ; CHECK-NEXT: br label [[BB18]]
31 ; CHECK-NEXT: [[I19]] = phi ptr [ [[I16]], [[BB17]] ], [ [[I14]], [[BB13]] ]
32 ; CHECK-NEXT: [[I20]] = phi ptr [ [[I15]], [[BB17]] ], [ [[I14]], [[BB13]] ]
33 ; CHECK-NEXT: br i1 [[A]], label [[BB2]], label [[BB13]]
38 bb1: ; No predecessors!
39 br i1 %a, label %bb2, label %bb9
41 bb2: ; preds = %bb21, %bb1
42 %i = phi ptr [ getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1), %bb1 ], [ %i20, %bb21 ]
43 %i3 = phi ptr [ getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1), %bb1 ], [ %i19, %bb21 ]
46 bb4: ; No predecessors!
47 %i5 = icmp ugt i8 %b, 50
50 bb6: ; preds = %bb9, %bb4
51 %i7 = phi ptr [ %i, %bb4 ], [ getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1), %bb9 ]
52 %i8 = phi ptr [ %i3, %bb4 ], [ getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1), %bb9 ]
58 bb10: ; preds = %bb6, %bb
59 %i11 = phi ptr [ @_MergedGlobals, %bb ], [ %i7, %bb6 ]
60 %i12 = phi ptr [ @_MergedGlobals, %bb ], [ %i8, %bb6 ]
63 bb13: ; preds = %bb18, %bb10
64 %i14 = phi ptr [ %i20, %bb18 ], [ %i11, %bb10 ]
65 %i15 = phi ptr [ %i20, %bb18 ], [ %i12, %bb10 ]
66 %i16 = phi ptr [ %i19, %bb18 ], [ %i12, %bb10 ]
67 br i1 %a, label %bb18, label %bb17
70 store i32 5, ptr %i15, align 4
73 bb18: ; preds = %bb17, %bb13
74 %i19 = phi ptr [ %i16, %bb17 ], [ %i14, %bb13 ]
75 %i20 = phi ptr [ %i15, %bb17 ], [ %i14, %bb13 ]
76 br i1 %a, label %bb21, label %bb13