1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -gvn -S | FileCheck %s 3 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. 6 7%struct.pluto = type <{ i8, i8 }> 8 9define void @widget(%struct.pluto** %tmp1) { 10; CHECK-LABEL: @widget( 11; CHECK-NEXT: bb: 12; CHECK-NEXT: callbr void asm sideeffect "", "X,X"(i8* blockaddress(@widget, [[BB5:%.*]]), i8* blockaddress(@widget, [[BB8:%.*]])) 13; CHECK-NEXT: to label [[BB4:%.*]] [label [[BB5]], label %bb8] 14; CHECK: bb4: 15; CHECK-NEXT: br label [[BB5]] 16; CHECK: bb5: 17; CHECK-NEXT: [[TMP6:%.*]] = load %struct.pluto*, %struct.pluto** [[TMP1:%.*]] 18; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT_PLUTO:%.*]], %struct.pluto* [[TMP6]], i64 0, i32 1 19; CHECK-NEXT: br label [[BB8]] 20; CHECK: bb8: 21; CHECK-NEXT: [[TMP9:%.*]] = phi i8* [ [[TMP7]], [[BB5]] ], [ null, [[BB:%.*]] ] 22; CHECK-NEXT: [[TMP10:%.*]] = load %struct.pluto*, %struct.pluto** [[TMP1]] 23; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT_PLUTO]], %struct.pluto* [[TMP10]], i64 0, i32 0 24; CHECK-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP11]] 25; CHECK-NEXT: tail call void @spam(i8* [[TMP9]], i8 [[TMP12]]) 26; CHECK-NEXT: ret void 27; 28bb: 29 callbr void asm sideeffect "", "X,X"(i8* blockaddress(@widget, %bb5), i8* blockaddress(@widget, %bb8)) 30 to label %bb4 [label %bb5, label %bb8] 31 32bb4: ; preds = %bb 33 br label %bb5 34 35bb5: ; preds = %bb4, %bb 36 %tmp6 = load %struct.pluto*, %struct.pluto** %tmp1 37 %tmp7 = getelementptr inbounds %struct.pluto, %struct.pluto* %tmp6, i64 0, i32 1 38 br label %bb8 39 40bb8: ; preds = %bb5, %bb 41 %tmp9 = phi i8* [ %tmp7, %bb5 ], [ null, %bb ] 42 %tmp10 = load %struct.pluto*, %struct.pluto** %tmp1 43 %tmp11 = getelementptr inbounds %struct.pluto, %struct.pluto* %tmp10, i64 0, i32 0 44 %tmp12 = load i8, i8* %tmp11 45 tail call void @spam(i8* %tmp9, i8 %tmp12) 46 ret void 47} 48 49declare void @spam(i8*, i8) 50