[llvm] [DebugInfo][RemoveDIs][NFC] Split findDbgDeclares into two functions (PR #77478)
Carlos Alberto Enciso via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 02:35:55 PST 2024
================
@@ -44,6 +44,44 @@ using namespace llvm;
using namespace llvm::at;
using namespace llvm::dwarf;
+TinyPtrVector<DbgDeclareInst *> llvm::findDbgDeclares(Value *V) {
+ // This function is hot. Check whether the value has any metadata to avoid a
+ // DenseMap lookup.
+ if (!V->isUsedByMetadata())
+ return {};
+ auto *L = LocalAsMetadata::getIfExists(V);
+ if (!L)
+ return {};
+ auto *MDV = MetadataAsValue::getIfExists(V->getContext(), L);
+ if (!MDV)
+ return {};
+
+ TinyPtrVector<DbgDeclareInst *> Declares;
+ for (User *U : MDV->users()) {
----------------
CarlosAlbertoEnciso wrote:
The braces in the `for` are not needed.
https://github.com/llvm/llvm-project/pull/77478
More information about the llvm-commits
mailing list