Index: llvm/trunk/lib/IR/Verifier.cpp =================================================================== --- llvm/trunk/lib/IR/Verifier.cpp +++ llvm/trunk/lib/IR/Verifier.cpp @@ -217,6 +217,12 @@ /// Cache of constants visited in search of ConstantExprs. SmallPtrSet ConstantExprVisited; + // Verify that this GlobalValue is only used in this module. + // This map is used to avoid visiting uses twice. We can arrive at a user + // twice, if they have multiple operands. In particular for very large + // constant expressions, we can arrive at a particular user many times. + SmallPtrSet GlobalValueVisited; + void checkAtomicMemAccessSize(const Module *M, Type *Ty, const Instruction *I); public: @@ -494,12 +500,7 @@ if (GV.isDeclarationForLinker()) Assert(!GV.hasComdat(), "Declaration may not be in a Comdat!", &GV); - // Verify that this GlobalValue is only used in this module. - // This map is used to avoid visiting uses twice. We can arrive at a user - // twice, if they have multiple operands. In particular for very large - // constant expressions, we can arrive at a particular user many times. - SmallPtrSet Visited; - forEachUser(&GV, Visited, [&](const Value *V) -> bool { + forEachUser(&GV, GlobalValueVisited, [&](const Value *V) -> bool { if (const Instruction *I = dyn_cast(V)) { if (!I->getParent() || !I->getParent()->getParent()) CheckFailed("Global is referenced by parentless instruction!", &GV,