================
@@ -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)),
----------------
pcc wrote:
IIUC you could remove the 0 constant here. The CFI `!type` metadata sets this
field to a non-zero value to represent a non-zero offset from the start of the
global to the vtable address point, which isn't relevant if this call graph
only contains functions.
https://github.com/llvm/llvm-project/pull/204266
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits