diff options
author | Vedant Kumar <vsk@apple.com> | 2018-02-22 01:29:41 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-02-22 01:29:41 +0000 |
commit | 1ceabcf080b4e46681554a23273018b15576536c (patch) | |
tree | 5589faff72d7a92310b52fd65ab22a130b49cb8a /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 55b7e01116bf883c659b3ad2a16cc7c218b739fa (diff) | |
download | bcm5719-llvm-1ceabcf080b4e46681554a23273018b15576536c.tar.gz bcm5719-llvm-1ceabcf080b4e46681554a23273018b15576536c.zip |
[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
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index e75127f77e8..7573fc39b9d 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -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()) |