forked from OSchip/llvm-project
[Utils] Avoid a hash table lookup in salvageDI, NFC
According to the current coverage report salvageDebugInfo() is called 5.12 million times during testing and almost always returns early. The early return depends on LocalAsMetadata::getIfExists returning null, which involves a DenseMap lookup in an LLVMContextImpl. We can probably speed this up by simply checking the IsUsedByMD bit in Value. llvm-svn: 325738
This commit is contained in:
parent
55b7e01116
commit
1ceabcf080
|
@ -1486,6 +1486,11 @@ void llvm::replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
|
|||
}
|
||||
|
||||
void llvm::salvageDebugInfo(Instruction &I) {
|
||||
// This function is hot. An early check to determine whether the instruction
|
||||
// has any metadata to save allows it to return earlier on average.
|
||||
if (!I.isUsedByMetadata())
|
||||
return;
|
||||
|
||||
SmallVector<DbgInfoIntrinsic *, 1> DbgUsers;
|
||||
findDbgUsers(DbgUsers, &I);
|
||||
if (DbgUsers.empty())
|
||||
|
|
Loading…
Reference in New Issue