[llvm] Metadata: Optimize metadata queries (PR #70700)

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 08:22:21 PDT 2023


================
@@ -1620,10 +1629,7 @@ void Instruction::setNoSanitizeMetadata() {
 }
 
 MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
-  // Handle 'dbg' as a special case since it is not stored in the hash table.
-  if (KindID == LLVMContext::MD_dbg)
-    return DbgLoc.getAsMDNode();
-  return Value::getMetadata(KindID);
+  return getValueMetadata(*this, KindID, getContext());
----------------
dexonsmith wrote:

On that note, does this function even need to exist still? Or should callers directly call getValueMetadata? If it's useful, should it be renamed getValueMetadata (an overload with fewer parameters)?

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


More information about the llvm-commits mailing list