[LLVMbugs] [Bug 23865] New: Dumping machine instructions is slow on large functions.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 16 20:42:25 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23865

            Bug ID: 23865
           Summary: Dumping machine instructions is slow on large
                    functions.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: matze at braunis.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14479
  --> https://llvm.org/bugs/attachment.cgi?id=14479&action=edit
example that dumps slowly

Using "llc -print-machineinstrs" is extremely slow on large files. The attached
235K example dumps at the speed of ~0.5s per basic block on a debug build for
me. It seems like Value::printAsOperand() internally creates a SlotTracker
again for each operand, which ends up enumerating all the values in the
function again and again.

Extract from an instruments profile for 10 seconds:

Running Time    Self (ms)        Symbol Name
10015.0ms   99.8%    0.0         start
10015.0ms   99.8%    0.0          main
10014.0ms   99.8%    0.0           compileModule(char**, llvm::LLVMContext&)
9933.0ms   99.0%    0.0           
llvm::legacy::PassManager::run(llvm::Module&)
9933.0ms   99.0%    0.0            
llvm::legacy::PassManagerImpl::run(llvm::Module&)
9932.0ms   99.0%    0.0              (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
9931.0ms   99.0%    0.0              
llvm::FPPassManager::runOnModule(llvm::Module&)
9931.0ms   99.0%    0.0               
llvm::FPPassManager::runOnFunction(llvm::Function&)
9832.0ms   98.0%    0.0                
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
9514.0ms   94.8%    0.0                  (anonymous
namespace)::MachineFunctionPrinterPass::runOnMachineFunction(llvm::MachineFunction&)
9514.0ms   94.8%    0.0                  
llvm::MachineFunction::print(llvm::raw_ostream&, llvm::SlotIndexes*) const
9513.0ms   94.8%    0.0                   
llvm::MachineBasicBlock::print(llvm::raw_ostream&, llvm::SlotIndexes*) const
9030.0ms   90.0%    0.0                    
llvm::Value::printAsOperand(llvm::raw_ostream&, bool, llvm::Module const*)
const
9030.0ms   90.0%    0.0                     
WriteAsOperandInternal(llvm::raw_ostream&, llvm::Value const*, (anonymous
namespace)::TypePrinting*, (anonymous namespace)::SlotTracker*, llvm::Module
const*)
9030.0ms   90.0%    0.0                       (anonymous
namespace)::SlotTracker::getLocalSlot(llvm::Value const*)
9030.0ms   90.0%    0.0                        (anonymous
namespace)::SlotTracker::initialize()
9030.0ms   90.0%    1.0                         (anonymous
namespace)::SlotTracker::processFunction()
8976.0ms   89.4%    259.0                          (anonymous
namespace)::SlotTracker::processFunctionMetadata(llvm::Function const&)
7281.0ms   72.5%    286.0                           (anonymous
namespace)::SlotTracker::processInstructionMetadata(llvm::Instruction const&)
302.0ms    3.0%    32.0                          
llvm::Function::getAllMetadata(llvm::SmallVectorImpl<std::__1::pair<unsigned
int, llvm::MDNode*> >&) const
270.0ms    2.6%    29.0                           llvm::BasicBlock::end() const
257.0ms    2.5%    37.0                           llvm::BasicBlock::begin()
const
185.0ms    1.8%    42.0                          
llvm::ilist_iterator<llvm::Instruction const>::operator++()
151.0ms    1.5%    73.0                          
llvm::ilist_iterator<llvm::BasicBlock const>::operator++()
129.0ms    1.2%    129.0                          
llvm::ilist_iterator<llvm::Instruction
const>::operator!=(llvm::ilist_iterator<llvm::Instruction const> const&) const
39.0ms    0.3%    39.0                          
llvm::ilist_iterator<llvm::BasicBlock
const>::operator!=(llvm::ilist_iterator<llvm::BasicBlock const> const&) const
37.0ms    0.3%    37.0                          
llvm::ilist_iterator<llvm::Instruction const>::operator*() const
27.0ms    0.2%    0.0                           <Unknown Address>
20.0ms    0.1%    20.0                          
llvm::SmallVectorTemplateCommon<std::__1::pair<unsigned int, llvm::MDNode*>,
void>::end()
10.0ms    0.0%    10.0                          
llvm::ilist_iterator<llvm::BasicBlock const>::operator*() const
8.0ms    0.0%    8.0                          
llvm::SmallVectorTemplateCommon<std::__1::pair<unsigned int, llvm::MDNode*>,
void>::begin()
1.0ms    0.0%    0.0                          
llvm::SmallVector<std::__1::pair<unsigned int, llvm::MDNode*>,
4u>::SmallVector()
22.0ms    0.2%    0.0                          <Unknown Address>
19.0ms    0.1%    1.0                          (anonymous
namespace)::SlotTracker::CreateFunctionSlot(llvm::Value const*)
3.0ms    0.0%    0.0                         
llvm::AttributeSet::getFnAttributes() const
2.0ms    0.0%    1.0                         
llvm::cast_retty<llvm::InvokeInst, llvm::Instruction const*>::ret_type
llvm::dyn_cast<llvm::InvokeInst, llvm::Instruction const>(llvm::Instruction
const*)
2.0ms    0.0%    2.0                          llvm::Value::getType() const
2.0ms    0.0%    0.0                          (anonymous
namespace)::SlotTracker::CreateAttributeSetSlot(llvm::AttributeSet)
1.0ms    0.0%    0.0                          llvm::Type::isVoidTy() const
1.0ms    0.0%    0.0                          llvm::cast_retty<llvm::CallInst,
llvm::Instruction const*>::ret_type llvm::dyn_cast<llvm::CallInst,
llvm::Instruction const>(llvm::Instruction const*)
1.0ms    0.0%    0.0                          llvm::BasicBlock::begin() const
482.0ms    4.8%    0.0                    
llvm::MachineInstr::print(llvm::raw_ostream&, bool) const
1.0ms    0.0%    1.0                    
llvm::MachineBasicBlock::isLandingPad() const
1.0ms    0.0%    0.0                   
llvm::MachineJumpTableInfo::print(llvm::raw_ostream&) const
318.0ms    3.1%    0.0                  (anonymous
namespace)::AArch64DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
27.0ms    0.2%    0.0                
llvm::DominatorTreeWrapperPass::runOnFunction(llvm::Function&)
24.0ms    0.2%    0.0                 (anonymous
namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&)
19.0ms    0.1%    0.0                 (anonymous
namespace)::CFGSimplifyPass::runOnFunction(llvm::Function&)
12.0ms    0.1%    1.0                 (anonymous
namespace)::CodeGenPrepare::runOnFunction(llvm::Function&)
6.0ms    0.0%    0.0                
llvm::LoopInfoWrapperPass::runOnFunction(llvm::Function&)
4.0ms    0.0%    0.0                
llvm::BranchProbabilityInfo::runOnFunction(llvm::Function&)
1.0ms    0.0%    0.0                
llvm::PMDataManager::removeDeadPasses(llvm::Pass*, llvm::StringRef,
llvm::PassDebuggingString)
1.0ms    0.0%    0.0                 (anonymous
namespace)::ConstantHoisting::runOnFunction(llvm::Function&)
1.0ms    0.0%    1.0                 0x10adac8f6
1.0ms    0.0%    0.0                 (anonymous
namespace)::AtomicExpand::runOnFunction(llvm::Function&)
1.0ms    0.0%    0.0                 (anonymous
namespace)::UnreachableBlockElim::runOnFunction(llvm::Function&)
1.0ms    0.0%    1.0                
llvm::PMDataManager::dumpRequiredSet(llvm::Pass const*) const
1.0ms    0.0%    0.0                 (anonymous
namespace)::PartiallyInlineLibCalls::runOnFunction(llvm::Function&)
1.0ms    0.0%    0.0               (anonymous
namespace)::AArch64PromoteConstant::runOnModule(llvm::Module&)
1.0ms    0.0%    0.0             
llvm::PMTopLevelManager::initializeAllAnalysisInfo()
63.0ms    0.6%    0.0            llvm::parseIRFile(llvm::StringRef,
llvm::SMDiagnostic&, llvm::LLVMContext&)
13.0ms    0.1%    0.0            llvm::verifyModule(llvm::Module const&,
llvm::raw_ostream*)
4.0ms    0.0%    0.0           
llvm::LLVMTargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&,
llvm::raw_pwrite_stream&, llvm::TargetMachine::CodeGenFileType, bool, void
const*, void const*, llvm::MachineFunctionInitializer*)
1.0ms    0.0%    0.0           
llvm::TargetLibraryInfoImpl::TargetLibraryInfoImpl(llvm::Triple const&)
1.0ms    0.0%    0.0           llvm::cl::ParseCommandLineOptions(int, char
const* const*, char const*)
15.0ms    0.1%    0.0         _dyld_start

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150617/90033ff4/attachment.html>


More information about the llvm-bugs mailing list