[PATCH] Add a lock() function in PassRegistry to speed up multi-thread synchronization.

Owen Anderson resistor at mac.com
Thu Feb 26 19:55:24 PST 2015


Hi Erik,

> On Feb 20, 2015, at 5:24 AM, Erik Eckstein <eeckstein at apple.com> wrote:
> 
> I'm running llvm in multiple threads (each instance uses its private LLVMContext).
> With a release-asserts build of llvm I got terrible multi-thread performance. I found that the problem is the mutex in PassRegistry::getPassInfo(), mainly called from PMDataManager::verifyPreservedAnalysis().

Something doesn’t quite add up here.  If I look at the body of PMDataManager::verifyPreservedAnalsys(), I see:

/// verifyPreservedAnalysis -- Verify analysis preserved by pass P.             
void PMDataManager::verifyPreservedAnalysis(Pass *P) {                                                      
  // Don't do this unless assertions are enabled.                               
#ifdef NDEBUG                                                                   
  return;                                                                       
#endif 

Surely if you’re building release-asserts, there should be no cost at all associated with this method?

—Owen



More information about the llvm-commits mailing list