[llvm-dev] Unexpected performance issue in `findAnalysisPass`

edA-qa mort-ora-y via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 14 22:37:09 PDT 2017

My compiler recently slowed down and I'm trying to figure out the source
of it. I recently added a bit more of the target language to the build
process, so more IR is generated (not a lot mind you).

I ran `valgrind/callgrind` on my compiler and the results were not what
I expected. Instead of seeing my code I saw primarily LLVM code. Even
more strange is that it's mainly in the `findAnalysisPass`.

The top functions, in terms of inclusive time are:
    94.8% <cycle_3> (no function name, but inside llvm3-8.so)
    7.2% llvm::PMTopLevelManager::findAnalysisPass
    5.7% llvm::PMDataManager::findAnalysisPass

What I find even strange here is that I'm not adding any optimization
passes in this particular mode. My object file emitter is setup as:

    llvm::legacy::PassManager fpm;
    bool ret = machine->addPassesToEmitFile( fpm, out.os(),
llvm::TargetMachine::CGFT_ObjectFile );
    STATE_CHECK( !ret );

    module->setDataLayout( machine->createDataLayout() );
    fpm.run( *module );

Am I doing something wrong? Are these numbers from valgrind realistic,
or has it gotten confused somehow?

edA-qa mort-ora-y 

Leaf - the language we always wanted

More information about the llvm-dev mailing list