diff --git a/lib/CodeGen/ScheduleDAGInstrs.cpp b/lib/CodeGen/ScheduleDAGInstrs.cpp index d8905ec588d..218ba1a6149 100644 --- a/lib/CodeGen/ScheduleDAGInstrs.cpp +++ b/lib/CodeGen/ScheduleDAGInstrs.cpp @@ -62,9 +62,18 @@ static cl::opt HugeRegion("dag-maps-huge-region", cl::Hidden, "prior to scheduling, at which point a trade-off " "is made to avoid excessive compile time.")); -static cl::opt ReductionSize("dag-maps-reduction-size", cl::Hidden, +static cl::opt ReductionSize( + "dag-maps-reduction-size", cl::Hidden, cl::desc("A huge scheduling region will have maps reduced by this many " - "nodes at a time. Defaults to HugeRegion / 2.")); + "nodes at a time. Defaults to HugeRegion / 2.")); + +static unsigned getReductionSize() { + // Always reduce a huge region with half of the elements, except + // when user sets this number explicitly. + if (ReductionSize.getNumOccurrences() == 0) + return HugeRegion / 2; + return ReductionSize; +} static void dumpSUList(ScheduleDAGInstrs::SUList &L) { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) @@ -878,11 +887,6 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA, // done. Value2SUsMap NonAliasStores, NonAliasLoads(1 /*TrueMemOrderLatency*/); - // Always reduce a huge region with half of the elements, except - // when user sets this number explicitly. - if (ReductionSize.getNumOccurrences() == 0) - ReductionSize = (HugeRegion / 2); - // Remove any stale debug info; sometimes BuildSchedGraph is called again // without emitting the info from the previous call. DbgValues.clear(); @@ -1077,11 +1081,11 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA, // Reduce maps if they grow huge. if (Stores.size() + Loads.size() >= HugeRegion) { DEBUG(dbgs() << "Reducing Stores and Loads maps.\n";); - reduceHugeMemNodeMaps(Stores, Loads, ReductionSize); + reduceHugeMemNodeMaps(Stores, Loads, getReductionSize()); } if (NonAliasStores.size() + NonAliasLoads.size() >= HugeRegion) { DEBUG(dbgs() << "Reducing NonAliasStores and NonAliasLoads maps.\n";); - reduceHugeMemNodeMaps(NonAliasStores, NonAliasLoads, ReductionSize); + reduceHugeMemNodeMaps(NonAliasStores, NonAliasLoads, getReductionSize()); } }