[PATCH] D24940: [thinlto] Add cold-callsite import heuristic

Piotr Padlewski via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 17:16:39 PDT 2016


Prazek marked an inline comment as done.

================
Comment at: lib/Transforms/IPO/FunctionImport.cpp:296
@@ +295,3 @@
+      BonusMultiplier = ImportHotMultiplier;
+    else if (Edge.second.Hotness == CalleeInfo::HotnessType::Cold)
+      BonusMultiplier = ImportColdMultiplier;
----------------
mehdi_amini wrote:
> Oh I see why you did it. Maybe a static function close to the cl::opt?
> 
> `const float BonusMultiplier = getBonusMultiplierForHotness(Edge.second.Hotness);`
> 
> (Straw man naming)
what about
  auto GetBonusMultiplier = [](CalleeInfo::HotnessType Hotness) {
      if (Hotness == CalleeInfo::HotnessType::Hot)
        return ImportHotMultiplier;
      if (Hotness == CalleeInfo::HotnessType::Cold)
        return ImportColdMultiplier;
      return 1.0;
    };
    
    const auto NewThreshold = Threshold * GetBonusMultiplier(Edge.second.Hotness);


https://reviews.llvm.org/D24940





More information about the llvm-commits mailing list