diff options
author | OCHyams <orlando.hyams@sony.com> | 2021-04-19 09:54:22 +0100 |
---|---|---|
committer | OCHyams <orlando.hyams@sony.com> | 2021-04-19 10:30:25 +0100 |
commit | 0ebf9a8e34b6aeee520aa5dc6916a155c5789533 (patch) | |
tree | 88b886810737e6a1c9ff7b5e0a37d6833e1cb132 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | fb2aa63d7dc54800d8a08df198e261a95bcefdbe (diff) | |
download | llvm-0ebf9a8e34b6aeee520aa5dc6916a155c5789533.zip llvm-0ebf9a8e34b6aeee520aa5dc6916a155c5789533.tar.gz llvm-0ebf9a8e34b6aeee520aa5dc6916a155c5789533.tar.bz2 |
[DebugInfo] Move the findDbg* functions into DebugInfo.cpp
Move the findDbg* functions into lib/IR/DebugInfo.cpp from
lib/Transforms/Utils/Local.cpp.
D99169 adds a call to a function (findDbgUsers) that lives in
lib/Transforms/Utils/Local.cpp (LLVMTransformUtils) from lib/IR/Value.cpp
(LLVMCore). The Core lib doesn't include TransformUtils. The builtbots caught
this here: https://lab.llvm.org/buildbot/#/builders/109/builds/12664. This patch
moves the function, and the 3 similar ones for consistency, into DebugInfo.cpp
which is part of LLVMCore.
Reviewed By: dblaikie, rnk
Differential Revision: https://reviews.llvm.org/D100632
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 89e62fb..beea211 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -24,7 +24,6 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/TinyPtrVector.h" #include "llvm/Analysis/AssumeBundleQueries.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/DomTreeUpdater.h" @@ -1658,92 +1657,6 @@ void llvm::insertDebugValuesForPHIs(BasicBlock *BB, } } -/// Finds all intrinsics declaring local variables as living in the memory that -/// 'V' points to. This may include a mix of dbg.declare and -/// dbg.addr intrinsics. -TinyPtrVector<DbgVariableIntrinsic *> llvm::FindDbgAddrUses(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<DbgVariableIntrinsic *> Declares; - for (User *U : MDV->users()) { - if (auto *DII = dyn_cast<DbgVariableIntrinsic>(U)) - if (DII->isAddressOfVariable()) - Declares.push_back(DII); - } - - return Declares; -} - -TinyPtrVector<DbgDeclareInst *> llvm::FindDbgDeclareUses(Value *V) { - TinyPtrVector<DbgDeclareInst *> DDIs; - for (DbgVariableIntrinsic *DVI : FindDbgAddrUses(V)) - if (auto *DDI = dyn_cast<DbgDeclareInst>(DVI)) - DDIs.push_back(DDI); - return DDIs; -} - -void llvm::findDbgValues(SmallVectorImpl<DbgValueInst *> &DbgValues, Value *V) { - // This function is hot. Check whether the value has any metadata to avoid a - // DenseMap lookup. - if (!V->isUsedByMetadata()) - return; - // TODO: If this value appears multiple times in a DIArgList, we should still - // only add the owning DbgValueInst once; use this set to track ArgListUsers. - // This behaviour can be removed when we can automatically remove duplicates. - SmallPtrSet<DbgValueInst *, 4> EncounteredDbgValues; - if (auto *L = LocalAsMetadata::getIfExists(V)) { - if (auto *MDV = MetadataAsValue::getIfExists(V->getContext(), L)) { - for (User *U : MDV->users()) - if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(U)) - DbgValues.push_back(DVI); - } - for (Metadata *AL : L->getAllArgListUsers()) { - if (auto *MDV = MetadataAsValue::getIfExists(V->getContext(), AL)) { - for (User *U : MDV->users()) - if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(U)) - if (EncounteredDbgValues.insert(DVI).second) - DbgValues.push_back(DVI); - } - } - } -} - -void llvm::findDbgUsers(SmallVectorImpl<DbgVariableIntrinsic *> &DbgUsers, - Value *V) { - // This function is hot. Check whether the value has any metadata to avoid a - // DenseMap lookup. - if (!V->isUsedByMetadata()) - return; - // TODO: If this value appears multiple times in a DIArgList, we should still - // only add the owning DbgValueInst once; use this set to track ArgListUsers. - // This behaviour can be removed when we can automatically remove duplicates. - SmallPtrSet<DbgVariableIntrinsic *, 4> EncounteredDbgValues; - if (auto *L = LocalAsMetadata::getIfExists(V)) { - if (auto *MDV = MetadataAsValue::getIfExists(V->getContext(), L)) { - for (User *U : MDV->users()) - if (DbgVariableIntrinsic *DII = dyn_cast<DbgVariableIntrinsic>(U)) - DbgUsers.push_back(DII); - } - for (Metadata *AL : L->getAllArgListUsers()) { - if (auto *MDV = MetadataAsValue::getIfExists(V->getContext(), AL)) { - for (User *U : MDV->users()) - if (DbgVariableIntrinsic *DII = dyn_cast<DbgVariableIntrinsic>(U)) - if (EncounteredDbgValues.insert(DII).second) - DbgUsers.push_back(DII); - } - } - } -} - bool llvm::replaceDbgDeclare(Value *Address, Value *NewAddress, DIBuilder &Builder, uint8_t DIExprFlags, int Offset) { |