blob: b7108bd6e6cd9b23e651a027e1deceb9e04f1424 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s
; musttail calls can't be outlined, because they have several restrictions
; enforcing matching calling conventions between the parent and callee.
define void @test_musttail(i1 %b) {
; CHECK-LABEL: define void @test_musttail(
; CHECK-SAME: i1 [[B:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: br i1 [[B]], label %[[IF_THEN:.*]], label %[[IF_ELSE:.*]]
; CHECK: [[IF_THEN]]:
; CHECK-NEXT: ret void
; CHECK: [[IF_ELSE]]:
; CHECK-NEXT: musttail call void @target(i1 [[B]])
; CHECK-NEXT: ret void
;
entry:
br i1 %b, label %if.then, label %if.else
if.then:
ret void
if.else:
musttail call void @target(i1 %b)
ret void
}
define void @test_tail(i1 %b) {
; CHECK-LABEL: define void @test_tail(
; CHECK-SAME: i1 [[B:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: br i1 [[B]], label %[[IF_THEN:.*]], label %[[CODEREPL:.*]]
; CHECK: [[IF_THEN]]:
; CHECK-NEXT: ret void
; CHECK: [[CODEREPL]]:
; CHECK-NEXT: call void @test_tail.cold.1(i1 [[B]]) #[[ATTR2:[0-9]+]]
; CHECK-NEXT: br label %[[IF_ELSE_RET:.*]]
; CHECK: [[IF_ELSE_RET]]:
; CHECK-NEXT: ret void
;
entry:
br i1 %b, label %if.then, label %if.else
if.then:
ret void
if.else:
tail call void @target(i1 %b)
ret void
}
declare void @target() cold
|