[GVNHoist] Sink HoistedCtr into GVNHoist

HoistedCtr cannot be a mutated global variable, that will open us up to
races between threads compiling code in parallel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275744 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2016-07-18 00:35:01 +00:00
parent 326770a316
commit a6f9e21635

View File

@ -47,8 +47,6 @@ static cl::opt<int> MaxNumberOfBBSInPath(
cl::desc("Max number of basic blocks on the path between "
"hoisting locations (default = 4, unlimited = -1)"));
static int HoistedCtr = 0;
namespace {
// Provides a sorting function based on the execution order of two instructions.
@ -183,11 +181,13 @@ public:
DenseMap<const BasicBlock *, unsigned> DFSNumber;
BBSideEffectsSet BBSideEffects;
MemorySSA *MSSA;
int HoistedCtr;
enum InsKind { Unknown, Scalar, Load, Store };
GVNHoist(DominatorTree *Dt, AliasAnalysis *Aa, MemoryDependenceResults *Md,
bool OptForMinSize)
: DT(Dt), AA(Aa), MD(Md), OptForMinSize(OptForMinSize) {}
: DT(Dt), AA(Aa), MD(Md), OptForMinSize(OptForMinSize), HoistedCtr(0) {}
// Return true when there are exception handling in BB.
bool hasEH(const BasicBlock *BB) {