]> granicus.if.org Git - llvm/commitdiff
[HotColdSplit] Remove a set which tracked split functions (NFC)
authorVedant Kumar <vsk@apple.com>
Sat, 19 Jan 2019 02:38:17 +0000 (02:38 +0000)
committerVedant Kumar <vsk@apple.com>
Sat, 19 Jan 2019 02:38:17 +0000 (02:38 +0000)
Use the begin/end iterator idiom to avoid visiting split functions,
instead of doing a set lookup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351622 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/HotColdSplitting.cpp

index 6876ae602598b9d0e12e3b1d0a7dd296b9c2b3c2..d6ac7183f770c69f763d6f09877558c1f5e95ece 100644 (file)
@@ -183,7 +183,6 @@ private:
   Function *extractColdRegion(const BlockSequence &Region, DominatorTree &DT,
                               BlockFrequencyInfo *BFI, TargetTransformInfo &TTI,
                               OptimizationRemarkEmitter &ORE, unsigned Count);
-  SmallPtrSet<const Function *, 2> OutlinedFunctions;
   ProfileSummaryInfo *PSI;
   function_ref<BlockFrequencyInfo *(Function &)> GetBFI;
   function_ref<TargetTransformInfo &(Function &)> GetTTI;
@@ -212,10 +211,6 @@ public:
 // Returns false if the function should not be considered for hot-cold split
 // optimization.
 bool HotColdSplitting::shouldOutlineFrom(const Function &F) const {
-  // Do not try to outline again from an already outlined cold function.
-  if (OutlinedFunctions.count(&F))
-    return false;
-
   if (F.size() <= 2)
     return false;
 
@@ -540,7 +535,6 @@ bool HotColdSplitting::outlineColdRegions(Function &F, ProfileSummaryInfo &PSI,
           extractColdRegion(SubRegion, DT, BFI, TTI, ORE, OutlinedFunctionID);
       if (Outlined) {
         ++OutlinedFunctionID;
-        OutlinedFunctions.insert(Outlined);
         Changed = true;
       }
     } while (!Region.empty());
@@ -551,8 +545,9 @@ bool HotColdSplitting::outlineColdRegions(Function &F, ProfileSummaryInfo &PSI,
 
 bool HotColdSplitting::run(Module &M) {
   bool Changed = false;
-  OutlinedFunctions.clear();
-  for (auto &F : M) {
+  for (auto It = M.begin(), End = M.end(); It != End; ++It) {
+    Function &F = *It;
+
     if (!shouldOutlineFrom(F)) {
       LLVM_DEBUG(llvm::dbgs() << "Skipping " << F.getName() << "\n");
       continue;