[PATCH] Fix initialization problems with PassRegistry

Zachary Turner zturner at google.com
Wed Jun 11 10:46:23 PDT 2014


There are a couple of things that lead to the original issue.  Another one is the use of the Mutex.  Mutex is locked in the destructor of the PassRegistry, and the PassRegistry itself is a ManagedStatic.  So the PassRegistry is allocated lazily, then the first time a method is called the Mutex is allocated.  Then during shutdown Mutex is freed, then PassRegistry is freed, calling PassRegistry's destructor, locking the mutex again.

Also, I'm not sure if it's as easy as removing PassRegistrationListener's automatic registration / deregistration.  I tried that and ran into some problems somewhere else, although the details escape me.  If needed I can go back and do some digging to figure out what it was.  That being said, I don't want to spend too much additional time on this, as it was mostly intended to be a drive-by cleanup task tangential to my original goal.

http://reviews.llvm.org/D3996






More information about the llvm-commits mailing list