File: indirect_call_promotion_musttail.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (72 lines) | stat: -rw-r--r-- 2,741 bytes parent folder | download | duplicates (15)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@foo = common global ptr null, align 8

define ptr @func1() {
  ret ptr null
}

define ptr @func2() {
  ret ptr null
}

define ptr @func3() {
  ret ptr null
}

define ptr @func4() {
  ret ptr null
}

define ptr @bar() {
entry:
  %tmp = load ptr, ptr @foo, align 8
; ICALL-PROM:   [[CMP1:%[0-9]+]] = icmp eq ptr %tmp, @func4
; ICALL-PROM:   br i1 [[CMP1]], label %if.true.direct_targ, label %[[L1:[0-9]+]], !prof [[BRANCH_WEIGHT1:![0-9]+]]
; ICALL-PROM: if.true.direct_targ:
; ICALL-PROM:   [[DIRCALL_RET1:%[0-9]+]] = musttail call ptr @func4()
; ICALL-PROM:   ret ptr [[DIRCALL_RET1]]
; ICALL-PROM: [[L1]]:
; ICALL-PROM:   [[CMP2:%[0-9]+]] = icmp eq ptr %tmp, @func2
; ICALL-PROM:   br i1 [[CMP2]], label %if.true.direct_targ1, label %[[L2:[0-9]+]], !prof [[BRANCH_WEIGHT2:![0-9]+]]
; ICALL-PROM: if.true.direct_targ1:
; ICALL-PROM:   [[DIRCALL_RET2:%[0-9]+]] = musttail call ptr @func2()
; ICALL-PROM:   ret ptr [[DIRCALL_RET2]]
; ICALL-PROM: [[L2]]:
; ICALL-PROM:   [[CMP3:%[0-9]+]] = icmp eq ptr %tmp, @func3
; ICALL-PROM:   br i1 [[CMP3]], label %if.true.direct_targ2, label %[[L3:[0-9]+]], !prof [[BRANCH_WEIGHT3:![0-9]+]]
; ICALL-PROM: if.true.direct_targ2:
; ICALL-PROM:   [[DIRCALL_RET3:%[0-9]+]] = musttail call ptr @func3()
; ICALL-PROM:   ret ptr [[DIRCALL_RET3]]
; ICALL-PROM: [[L3]]:
; ICALL-PROM:   %call = musttail call ptr %tmp()
; ICALL-PROM:   ret ptr %call
  %call = musttail call ptr %tmp(), !prof !1
  ret ptr %call
}

define ptr @bar2() {
entry:
  %tmp = load ptr, ptr @foo, align 8
; ICALL-PROM:   [[CMP1:%[0-9]+]] = icmp eq ptr %tmp, @func4
; ICALL-PROM:   br i1 [[CMP1]], label %if.true.direct_targ, label %[[L4:[0-9]+]], !prof [[BRANCH_WEIGHT4:![0-9]+]]
; ICALL-PROM: if.true.direct_targ:
; ICALL-PROM:   [[DIRCALL_RET1:%[0-9]+]] = musttail call ptr @func4()
; ICALL-PROM:   ret ptr [[DIRCALL_RET1]]
; ICALL-PROM: [[L4]]:
; ICALL-PROM:   %call = musttail call ptr %tmp()
; ICALL-PROM:   ret ptr %call
  %call = musttail call ptr %tmp(), !prof !2
  ret ptr %call
}

!1 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410, i64 -6929281286627296573, i64 150, i64 -2545542355363006406, i64 10}
!2 = !{!"VP", i32 0, i64 100, i64 7651369219802541373, i64 100}

; ICALL-PROM: [[BRANCH_WEIGHT1]] = !{!"branch_weights", i32 1030, i32 570}
; ICALL-PROM: [[BRANCH_WEIGHT2]] = !{!"branch_weights", i32 410, i32 160}
; ICALL-PROM: [[BRANCH_WEIGHT3]] = !{!"branch_weights", i32 150, i32 10}
; ICALL-PROM: [[BRANCH_WEIGHT4]] = !{!"branch_weights", i32 100, i32 0}