================
@@ -3388,24 +3388,21 @@ 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);
- return MD && MD->hasGeneralizedMDString();
-}
-
void CodeGenModule::createIndirectFunctionTypeMD(const FunctionDecl *FD,
llvm::Function *F) {
- // Return if generalized type metadata is already attached.
- if (hasExistingGeneralizedTypeMD(F))
- return;
-
// All functions which are not internal linkage could be indirect targets.
// Address taken functions with internal linkage could be indirect targets.
if (!F->hasLocalLinkage() ||
F->getFunction().hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/true,
/*IgnoreAssumeLikeCalls=*/true,
- /*IgnoreLLVMUsed=*/false))
- F->addTypeMetadata(0, CreateMetadataIdentifierGeneralized(FD->getType()));
+ /*IgnoreLLVMUsed=*/false)) {
+ F->addMetadata(llvm::LLVMContext::MD_callgraph,
+ *llvm::MDTuple::get(
+ getLLVMContext(),
+ {llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
+ llvm::Type::getInt64Ty(getLLVMContext()), 0)),
----------------
Prabhuk wrote:
Thank you that makes sense. I have a patch downstream that removes the offset
here as well as in "callee_type" metadata. It blows up the size of this PR a
bit as it touches all call graph tests across clang and llvm. Keeping that in
mind, my question is should that change be part of this PR? Or should I send a
follow up PR focused on removing the offset field separately?
https://github.com/llvm/llvm-project/pull/204266
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits