diff --git a/llvm/lib/CodeGen/MachineFunctionSplitter.cpp b/llvm/lib/CodeGen/MachineFunctionSplitter.cpp --- a/llvm/lib/CodeGen/MachineFunctionSplitter.cpp +++ b/llvm/lib/CodeGen/MachineFunctionSplitter.cpp @@ -39,11 +39,18 @@ using namespace llvm; +// FIXME: This cutoff value is CPU dependent and should be moved to +// TargetTransformInfo once we consider enabling this on other platforms. +// The value is expressed as a ProfileSummaryInfo integer percentile cutoff. +// Defaults to 999950, i.e. all blocks colder than 99.995 percentile are split. +// The default was empirically determined to be optimal when considering cutoff +// values between 99%-ile to 100%-ile with respect to iTLB and icache metrics on +// Intel CPUs. static cl::opt PercentileCutoff("mfs-psi-cutoff", cl::desc("Percentile profile summary cutoff used to " "determine cold blocks. Unused if set to zero."), - cl::init(0), cl::Hidden); + cl::init(999950), cl::Hidden); static cl::opt ColdCountThreshold( "mfs-count-threshold", diff --git a/llvm/test/CodeGen/X86/machine-function-splitter.ll b/llvm/test/CodeGen/X86/machine-function-splitter.ll --- a/llvm/test/CodeGen/X86/machine-function-splitter.ll +++ b/llvm/test/CodeGen/X86/machine-function-splitter.ll @@ -1,5 +1,5 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s -check-prefix=MFS-DEFAULTS -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-count-threshold=2000 | FileCheck %s --dump-input=always -check-prefix=MFS-OPTS1 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-psi-cutoff=0 -mfs-count-threshold=2000 | FileCheck %s --dump-input=always -check-prefix=MFS-OPTS1 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-psi-cutoff=950000 | FileCheck %s -check-prefix=MFS-OPTS2 define void @foo1(i1 zeroext %0) nounwind !prof !14 !section_prefix !15 {