Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit e088ad8

Browse files
committed
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325738 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4acf80e commit e088ad8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Transforms/Utils/Local.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,11 @@ void llvm::replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
14861486
}
14871487

14881488
void llvm::salvageDebugInfo(Instruction &I) {
1489+
// This function is hot. An early check to determine whether the instruction
1490+
// has any metadata to save allows it to return earlier on average.
1491+
if (!I.isUsedByMetadata())
1492+
return;
1493+
14891494
SmallVector<DbgInfoIntrinsic *, 1> DbgUsers;
14901495
findDbgUsers(DbgUsers, &I);
14911496
if (DbgUsers.empty())

0 commit comments

Comments
 (0)