aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/PartialSpecialize/heuristics.ll
blob: 5ccf9ad86efa37222509f3742f36890a8b5b98f3 (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
; If there are not enough callsites for a particular specialization to
; justify its existence, the specialization shouldn't be created.
;
; RUN: opt -S -partialspecialization -disable-inlining %s | FileCheck %s 
declare void @callback1()
declare void @callback2()

declare void @othercall()

define internal void @UseCallback(void()* %pCallback) {
  call void %pCallback()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  call void @othercall()
  ret void
}

define void @foo(void()* %pNonConstCallback)
{
Entry:
; CHECK: Entry
; CHECK-NOT: call void @UseCallback(void ()* @callback1)
; CHECK: call void @UseCallback(void ()* @callback2)
; CHECK-NEXT: call void @UseCallback(void ()* @callback2)
; CHECK-NEXT: ret void
  call void @UseCallback(void()* @callback1)
  call void @UseCallback(void()* @callback1)
  call void @UseCallback(void()* @callback1)
  call void @UseCallback(void()* @callback1)
  call void @UseCallback(void()* @callback2)
  call void @UseCallback(void()* @callback2)

  ret void
}