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 scalar
5 ; PRE when the control flow uses a callbr instruction.
7 define void @wombat(i64 %arg, i64* %arg1, i64 %arg2, i32* %arg3) {
8 ; CHECK-LABEL: @wombat(
10 ; CHECK-NEXT: [[TMP5:%.*]] = or i64 [[ARG2:%.*]], [[ARG:%.*]]
11 ; CHECK-NEXT: callbr void asm sideeffect "", "X,X"(i8* blockaddress(@wombat, [[BB7:%.*]]), i8* blockaddress(@wombat, [[BB9:%.*]]))
12 ; CHECK-NEXT: to label [[BB6:%.*]] [label [[BB7]], label %bb9]
14 ; CHECK-NEXT: br label [[BB7]]
16 ; CHECK-NEXT: [[TMP8:%.*]] = trunc i64 [[TMP5]] to i32
17 ; CHECK-NEXT: tail call void @barney(i32 [[TMP8]])
18 ; CHECK-NEXT: br label [[BB9]]
20 ; CHECK-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP5]] to i32
21 ; CHECK-NEXT: store i32 [[TMP10]], i32* [[ARG3:%.*]]
22 ; CHECK-NEXT: ret void
25 %tmp5 = or i64 %arg2, %arg
26 callbr void asm sideeffect "", "X,X"(i8* blockaddress(@wombat, %bb7), i8* blockaddress(@wombat, %bb9))
27 to label %bb6 [label %bb7, label %bb9]
32 bb7: ; preds = %bb6, %bb
33 %tmp8 = trunc i64 %tmp5 to i32
34 tail call void @barney(i32 %tmp8)
37 bb9: ; preds = %bb7, %bb
38 %tmp10 = trunc i64 %tmp5 to i32
39 store i32 %tmp10, i32* %arg3
43 declare void @barney(i32)