[llvm] [RemoveDIs][NFC] Find DPValues using findDbgDeclares (PR #73500)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 04:08:18 PST 2023


================
@@ -44,29 +44,12 @@ using namespace llvm;
 using namespace llvm::at;
 using namespace llvm::dwarf;
 
-void llvm::findDbgDeclares(SmallVectorImpl<DbgDeclareInst *> &DbgUsers,
-                           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;
+template <typename IntrinsicT, bool AnyType,
+          DPValue::LocationType Type = DPValue::LocationType(-1)>
----------------
OCHyams wrote:

SGTM. Given it's already qualified by an enum class name `LocationType` I think `Any` should suffice? I'm not sure we need the `End` marker, but I've put it in there anyway. 

We could use bit flags (e.g. Any = 1 | 2)- I've no strong opinion either way and have not done so in the latest revsiion.

wdyt?

https://github.com/llvm/llvm-project/pull/73500


More information about the llvm-commits mailing list