[llvm] Add new llvm.dbg.declare_value intrinsic. (PR #168132)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 09:58:29 PST 2025


================
@@ -62,6 +62,23 @@ TinyPtrVector<DbgVariableRecord *> llvm::findDVRDeclares(Value *V) {
   return Declares;
 }
 
+TinyPtrVector<DbgVariableRecord *> llvm::findDVRDeclareValues(Value *V) {
+  // This function is hot. Check whether the value has any metadata to avoid a
+  // DenseMap lookup. This check is a bitfield datamember lookup.
+  if (!V->isUsedByMetadata())
+    return {};
+  auto *L = ValueAsMetadata::getIfExists(V);
+  if (!L)
+    return {};
+
+  TinyPtrVector<DbgVariableRecord *> Coros;
----------------
jmorse wrote:

IMO better to name this something other than "Coros" as the declare_value idea isn't conceptually bound to coroutines, it's (AFAIUI) more general than that. 

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


More information about the llvm-commits mailing list