From bbb28e7e98250e4fa218587633c700ee009e261f Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Thu, 2 Oct 2014 22:23:14 +0000 Subject: Fix the threshold added in r186434 (a re-apply of r185393) and updaated to be a ManagedStatic in r218163 to not be a global variable written and read to from within the innards of SpillPlacement. This will fix a really scary race condition for anyone that has two copies of LLVM running spill placement concurrently. Yikes! This will also fix a really significant compile time hit that r218163 caused because the spill placement threshold read is actually in the *very* hot path of this code. The memory fence on each read was showing up as huge compile time regressions when spilling is responsible for most of the compile time. For example, optimizing sanitized code showed over 50% compile time regressions here. =/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218921 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SpillPlacement.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/CodeGen/SpillPlacement.h') diff --git a/lib/CodeGen/SpillPlacement.h b/lib/CodeGen/SpillPlacement.h index 03cf5cd7424..622361e7e80 100644 --- a/lib/CodeGen/SpillPlacement.h +++ b/lib/CodeGen/SpillPlacement.h @@ -62,6 +62,10 @@ class SpillPlacement : public MachineFunctionPass { // Block frequencies are computed once. Indexed by block number. SmallVector BlockFrequencies; + /// Decision threshold. A node gets the output value 0 if the weighted sum of + /// its inputs falls in the open interval (-Threshold;Threshold). + BlockFrequency Threshold; + public: static char ID; // Pass identification, replacement for typeid. @@ -152,6 +156,7 @@ private: void releaseMemory() override; void activate(unsigned); + void setThreshold(const BlockFrequency &Entry); }; } // end namespace llvm -- cgit v1.2.3