================
@@ -2873,14 +2890,33 @@ void 
CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD,
 
   llvm::Metadata *MD = CreateMetadataIdentifierForType(FD->getType());
   F->addTypeMetadata(0, MD);
-  F->addTypeMetadata(0, CreateMetadataIdentifierGeneralized(FD->getType()));
+  // Add the generalized identifier if not added already.
+  if (!HasExistingGeneralizedTypeMD(F))
----------------
ilovepi wrote:

You can probably forgo the call to `hasExistingGeneralizedTypeMD()` altogether. 
The only way that this code would execute is if we're doing CFI and we'd add 
metadata. As the code is written that will always happen if you reach this 
point. Therefor, the MD won't exist, unless you've added it. You can track that 
w/ a local variable `bool AddedTypeMD`, and set it to true if you modify 
anything. 

https://github.com/llvm/llvm-project/pull/117036
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to