forked from OSchip/llvm-project
Do not modify a cl::opt programmatically, global mutable state is evil.
Found by TSAN on ThinLTO. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266514
This commit is contained in:
parent
a77d073305
commit
59ae854503
|
@ -62,10 +62,19 @@ static cl::opt<unsigned> HugeRegion("dag-maps-huge-region", cl::Hidden,
|
||||||
"prior to scheduling, at which point a trade-off "
|
"prior to scheduling, at which point a trade-off "
|
||||||
"is made to avoid excessive compile time."));
|
"is made to avoid excessive compile time."));
|
||||||
|
|
||||||
static cl::opt<unsigned> ReductionSize("dag-maps-reduction-size", cl::Hidden,
|
static cl::opt<unsigned> ReductionSize(
|
||||||
|
"dag-maps-reduction-size", cl::Hidden,
|
||||||
cl::desc("A huge scheduling region will have maps reduced by this many "
|
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) {
|
static void dumpSUList(ScheduleDAGInstrs::SUList &L) {
|
||||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||||
dbgs() << "{ ";
|
dbgs() << "{ ";
|
||||||
|
@ -878,11 +887,6 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA,
|
||||||
// done.
|
// done.
|
||||||
Value2SUsMap NonAliasStores, NonAliasLoads(1 /*TrueMemOrderLatency*/);
|
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
|
// Remove any stale debug info; sometimes BuildSchedGraph is called again
|
||||||
// without emitting the info from the previous call.
|
// without emitting the info from the previous call.
|
||||||
DbgValues.clear();
|
DbgValues.clear();
|
||||||
|
@ -1077,11 +1081,11 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA,
|
||||||
// Reduce maps if they grow huge.
|
// Reduce maps if they grow huge.
|
||||||
if (Stores.size() + Loads.size() >= HugeRegion) {
|
if (Stores.size() + Loads.size() >= HugeRegion) {
|
||||||
DEBUG(dbgs() << "Reducing Stores and Loads maps.\n";);
|
DEBUG(dbgs() << "Reducing Stores and Loads maps.\n";);
|
||||||
reduceHugeMemNodeMaps(Stores, Loads, ReductionSize);
|
reduceHugeMemNodeMaps(Stores, Loads, getReductionSize());
|
||||||
}
|
}
|
||||||
if (NonAliasStores.size() + NonAliasLoads.size() >= HugeRegion) {
|
if (NonAliasStores.size() + NonAliasLoads.size() >= HugeRegion) {
|
||||||
DEBUG(dbgs() << "Reducing NonAliasStores and NonAliasLoads maps.\n";);
|
DEBUG(dbgs() << "Reducing NonAliasStores and NonAliasLoads maps.\n";);
|
||||||
reduceHugeMemNodeMaps(NonAliasStores, NonAliasLoads, ReductionSize);
|
reduceHugeMemNodeMaps(NonAliasStores, NonAliasLoads, getReductionSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue