[llvm] r351622 - [HotColdSplit] Remove a set which tracked split functions (NFC)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 18 18:38:17 PST 2019
Author: vedantk
Date: Fri Jan 18 18:38:17 2019
New Revision: 351622
URL: http://llvm.org/viewvc/llvm-project?rev=351622&view=rev
Log:
[HotColdSplit] Remove a set which tracked split functions (NFC)
Use the begin/end iterator idiom to avoid visiting split functions,
instead of doing a set lookup.
Modified:
llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
Modified: llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp?rev=351622&r1=351621&r2=351622&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp Fri Jan 18 18:38:17 2019
@@ -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::outlineColdRegion
extractColdRegion(SubRegion, DT, BFI, TTI, ORE, OutlinedFunctionID);
if (Outlined) {
++OutlinedFunctionID;
- OutlinedFunctions.insert(Outlined);
Changed = true;
}
} while (!Region.empty());
@@ -551,8 +545,9 @@ bool HotColdSplitting::outlineColdRegion
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;
More information about the llvm-commits
mailing list