1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -gvn -S | FileCheck %s
4 ; This test checks that we don't hang trying to split a critical edge in loadpre
5 ; when the control flow uses a callbr instruction.
7 %struct.pluto = type <{ i8, i8 }>
9 define void @widget(%struct.pluto** %tmp1) {
10 ; CHECK-LABEL: @widget(
12 ; CHECK-NEXT: callbr void asm sideeffect "", "!i,!i"()
13 ; CHECK-NEXT: to label [[BB4:%.*]] [label [[BB5:%.*]], label %bb.bb8_crit_edge]
14 ; CHECK: bb.bb8_crit_edge:
15 ; CHECK-NEXT: [[TMP10_PRE:%.*]] = load %struct.pluto*, %struct.pluto** [[TMP1:%.*]], align 8
16 ; CHECK-NEXT: br label [[BB8:%.*]]
18 ; CHECK-NEXT: br label [[BB5]]
20 ; CHECK-NEXT: [[TMP6:%.*]] = load %struct.pluto*, %struct.pluto** [[TMP1]], align 8
21 ; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT_PLUTO:%.*]], %struct.pluto* [[TMP6]], i64 0, i32 1
22 ; CHECK-NEXT: br label [[BB8]]
24 ; CHECK-NEXT: [[TMP10:%.*]] = phi %struct.pluto* [ [[TMP6]], [[BB5]] ], [ [[TMP10_PRE]], [[BB_BB8_CRIT_EDGE:%.*]] ]
25 ; CHECK-NEXT: [[TMP9:%.*]] = phi i8* [ [[TMP7]], [[BB5]] ], [ null, [[BB_BB8_CRIT_EDGE]] ]
26 ; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT_PLUTO]], %struct.pluto* [[TMP10]], i64 0, i32 0
27 ; CHECK-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP11]], align 1
28 ; CHECK-NEXT: tail call void @spam(i8* [[TMP9]], i8 [[TMP12]])
29 ; CHECK-NEXT: ret void
32 callbr void asm sideeffect "", "!i,!i"()
33 to label %bb4 [label %bb5, label %bb8]
38 bb5: ; preds = %bb4, %bb
39 %tmp6 = load %struct.pluto*, %struct.pluto** %tmp1
40 %tmp7 = getelementptr inbounds %struct.pluto, %struct.pluto* %tmp6, i64 0, i32 1
43 bb8: ; preds = %bb5, %bb
44 %tmp9 = phi i8* [ %tmp7, %bb5 ], [ null, %bb ]
45 %tmp10 = load %struct.pluto*, %struct.pluto** %tmp1
46 %tmp11 = getelementptr inbounds %struct.pluto, %struct.pluto* %tmp10, i64 0, i32 0
47 %tmp12 = load i8, i8* %tmp11
48 tail call void @spam(i8* %tmp9, i8 %tmp12)
52 declare void @spam(i8*, i8)