<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW " title="NEW --- - Dumping machine instructions is slow on large functions." href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23865&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=cwcC9kkUVNp4zK0bxzAfVMCG61F0CHpBitrWa1MbMrk&s=TlbB-cck7FbXRSnrseGKwMWpl306aiI03foRsuYsUgA&e=">23865</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Dumping machine instructions is slow on large functions.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>matze@braunis.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=14479" name="attach_14479" title="example that dumps slowly">attachment 14479</a> <a href="attachment.cgi?id=14479&action=edit" title="example that dumps slowly">[details]</a></span>
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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>