From a6f9e21635522f6e67ad158404511bce62ff7cd7 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 18 Jul 2016 00:35:01 +0000 Subject: [PATCH] [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 --- lib/Transforms/Scalar/GVNHoist.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/Scalar/GVNHoist.cpp b/lib/Transforms/Scalar/GVNHoist.cpp index 16fc4850715..57f27731e1c 100644 --- a/lib/Transforms/Scalar/GVNHoist.cpp +++ b/lib/Transforms/Scalar/GVNHoist.cpp @@ -47,8 +47,6 @@ static cl::opt 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 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) { -- 2.49.0