aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorKenneth Uildriks <kennethuil@gmail.com>2010-10-09 22:06:36 +0000
committerKenneth Uildriks <kennethuil@gmail.com>2010-10-09 22:06:36 +0000
commit74fa7327d690e6ceda6ce77e4e5b8ef75cb12538 (patch)
tree7ccda8d95ec34025c4695626a629f0a0d6ff2e25 /test/Transforms
parentea1fe2c0a79e7984da5d4fbd538a0bdb2cd1d149 (diff)
downloadexternal_llvm-74fa7327d690e6ceda6ce77e4e5b8ef75cb12538.zip
external_llvm-74fa7327d690e6ceda6ce77e4e5b8ef75cb12538.tar.gz
external_llvm-74fa7327d690e6ceda6ce77e4e5b8ef75cb12538.tar.bz2
Now using a variant of the existing inlining heuristics to decide whether to create a given specialization of a function in PartialSpecialization. If the total performance bonus across all callsites passing the same constant exceeds the specialization cost, we create the specialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116158 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/PartialSpecialize/heuristics.ll49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/Transforms/PartialSpecialize/heuristics.ll b/test/Transforms/PartialSpecialize/heuristics.ll
new file mode 100644
index 0000000..5ccf9ad
--- /dev/null
+++ b/test/Transforms/PartialSpecialize/heuristics.ll
@@ -0,0 +1,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
+}