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
}
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())