diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index 14dcdf9e0364..55391df88869 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -25,6 +25,7 @@ #include "llvm/Support/Streams.h" #include "llvm/System/DynamicLibrary.h" #include "llvm/Target/TargetData.h" +#include "llvm/Support/ManagedStatic.h" #include #include #include @@ -33,7 +34,7 @@ using std::vector; using namespace llvm; typedef GenericValue (*ExFunc)(FunctionType *, const vector &); -static std::map Functions; +static ManagedStatic > Functions; static std::map FuncNames; static Interpreter *TheInterpreter; @@ -80,7 +81,7 @@ static ExFunc lookupFunction(const Function *F) { FnPtr = (ExFunc)(intptr_t) sys::DynamicLibrary::SearchForAddressOfSymbol(F->getName()); if (FnPtr != 0) - Functions.insert(std::make_pair(F, FnPtr)); // Cache for later + Functions->insert(std::make_pair(F, FnPtr)); // Cache for later return FnPtr; } @@ -90,8 +91,8 @@ GenericValue Interpreter::callExternalFunction(Function *F, // Do a lookup to see if the function is in our cache... this should just be a // deferred annotation! - std::map::iterator FI = Functions.find(F); - ExFunc Fn = (FI == Functions.end()) ? lookupFunction(F) : FI->second; + std::map::iterator FI = Functions->find(F); + ExFunc Fn = (FI == Functions->end()) ? lookupFunction(F) : FI->second; if (Fn == 0) { cerr << "Tried to execute an unknown external function: " << F->getType()->getDescription() << " " << F->getName() << "\n"; diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index 5caf01cf1001..3ef6376899a5 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -482,9 +482,9 @@ void CloneDomInfo(BasicBlock *NewBB, BasicBlock *Orig, for (DominanceFrontier::DomSetType::iterator I = S.begin(), E = S.end(); I != E; ++I) { BasicBlock *BB = *I; - DenseMap::iterator I = VM.find(BB); - if (I != VM.end()) - NewDFSet.insert(cast(I->second)); + DenseMap::iterator IDM = VM.find(BB); + if (IDM != VM.end()) + NewDFSet.insert(cast(IDM->second)); else NewDFSet.insert(BB); } diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp index 2bb4695c09b5..a8690041bf86 100644 --- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp +++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp @@ -240,8 +240,8 @@ void RegisterInfoEmitter::run(std::ostream &OS) { bool Empty = true; - for (unsigned subrc = 0, e2 = RC.SubRegClasses.size(); - subrc != e2; ++subrc) { + for (unsigned subrc = 0, subrcMax = RC.SubRegClasses.size(); + subrc != subrcMax; ++subrc) { unsigned rc2 = 0, e2 = RegisterClasses.size(); for (; rc2 != e2; ++rc2) { const CodeGenRegisterClass &RC2 = RegisterClasses[rc2];