Runtime flag to control branch funnel threshold
Reviewers: pcc
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D45193
llvm-svn: 329459
diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
index a3aa7c4..2c08cd8 100644
--- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -111,6 +111,11 @@
cl::desc("Write summary to given YAML file after running pass"),
cl::Hidden);
+static cl::opt<int> ClThreshold("wholeprogramdevirt-branch-funnel-threshold",
+ cl::Hidden, cl::init(10), cl::ZeroOrMore,
+ cl::desc("Maximum number of call targets per "
+ "call site to enable branch funnels"));
+
// Find the minimum offset that we may store a value of size Size bits at. If
// IsAfter is set, look for an offset before the object, otherwise look for an
// offset after the object.
@@ -820,8 +825,7 @@
if (T.getArch() != Triple::x86_64)
return;
- const unsigned kBranchFunnelThreshold = 10;
- if (TargetsForSlot.size() > kBranchFunnelThreshold)
+ if (TargetsForSlot.size() > ClThreshold)
return;
bool HasNonDevirt = !SlotInfo.CSInfo.AllCallSitesDevirted;