• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -partial-inliner -S | FileCheck %s
2; RUN: opt < %s -passes=partial-inliner -S | FileCheck %s
3
4; Check that we do not overcompute the outlined region cost, where the PHIs in
5; the outlined region entry (BB4) are moved outside the region by CodeExtractor.
6
7define i32 @bar(i32 %arg) {
8bb:
9  %tmp = icmp slt i32 %arg, 0
10  br i1 %tmp, label %bb1, label %bb2
11
12bb1:
13  br i1 undef, label %bb4, label %bb2
14
15bb2:                                              ; preds = %bb, %bb1
16  br i1 undef, label %bb4, label %bb5
17
18bb4:                                              ; preds = %bb1, %bb2
19  %xx1 = phi i32 [ 1, %bb1 ], [ 9, %bb2 ]
20  %xx2 = phi i32 [ 1, %bb1 ], [ 9, %bb2 ]
21  %xx3 = phi i32 [ 1, %bb1 ], [ 9, %bb2 ]
22  tail call void (...) @foo() #2
23  br label %bb5
24
25bb5:                                              ; preds = %bb4, %bb2
26  %tmp6 = phi i32 [ 1, %bb2 ], [ 9, %bb4 ]
27  ret i32 %tmp6
28}
29
30declare void @foo(...)
31
32define i32 @dummy_caller(i32 %arg) {
33bb:
34; CHECK-LABEL: @dummy_caller
35; CHECK: br i1
36; CHECK: br i1
37; CHECK: call void @bar.1.
38  %tmp = tail call i32 @bar(i32 %arg)
39  ret i32 %tmp
40}
41