• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 scalar
5; PRE when the control flow uses a callbr instruction.
6
7define void @wombat(i64 %arg, i64* %arg1, i64 %arg2, i32* %arg3) {
8; CHECK-LABEL: @wombat(
9; CHECK-NEXT:  bb:
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]
13; CHECK:       bb6:
14; CHECK-NEXT:    br label [[BB7]]
15; CHECK:       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]]
19; CHECK:       bb9:
20; CHECK-NEXT:    [[TMP10:%.*]] = trunc i64 [[TMP5]] to i32
21; CHECK-NEXT:    store i32 [[TMP10]], i32* [[ARG3:%.*]]
22; CHECK-NEXT:    ret void
23;
24bb:
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]
28
29bb6:                                              ; preds = %bb
30  br label %bb7
31
32bb7:                                              ; preds = %bb6, %bb
33  %tmp8 = trunc i64 %tmp5 to i32
34  tail call void @barney(i32 %tmp8)
35  br label %bb9
36
37bb9:                                              ; preds = %bb7, %bb
38  %tmp10 = trunc i64 %tmp5 to i32
39  store i32 %tmp10, i32* %arg3
40  ret void
41}
42
43declare void @barney(i32)
44