diff options
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) { |