[llvm-branch-commits] [clang] callee_type metadata for indirect calls (PR #117036)

Prabhu Rajasekaran via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 22 19:59:23 PDT 2025


================
@@ -2860,9 +2861,25 @@ static void setLinkageForGV(llvm::GlobalValue *GV, const NamedDecl *ND) {
     GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage);
 }
 
+static bool HasExistingGeneralizedTypeMD(llvm::Function *F) {
+  llvm::MDNode *MD = F->getMetadata(llvm::LLVMContext::MD_type);
+  if (!MD || !isa<llvm::MDString>(MD->getOperand(1)))
+    return false;
----------------
Prabhuk wrote:

This is to make sure that `CreateFunctionTypeMetadataforIcall` does not add duplicate ".generalized" type metadata. Given that the function can add non-generalized type metadata, checking the actual string becomes necessary.

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


More information about the llvm-branch-commits mailing list