================
@@ -3267,8 +3267,10 @@ void 
CodeGenModule::createFunctionTypeMetadataForIcall(const FunctionDecl *FD,
 
 void CodeGenModule::createCalleeTypeMetadataForIcall(const QualType &QT,
                                                      llvm::CallBase *CB) {
-  // Only if needed for call graph section and only for indirect calls.
-  if (!CodeGenOpts.CallGraphSection || !CB->isIndirectCall())
+  // Only if needed for call graph section and only for indirect calls that are
+  // visible externally.
+  if (!CodeGenOpts.CallGraphSection || !CB->isIndirectCall() ||
+      !isExternallyVisible(QT->getLinkage()))
----------------
Prabhuk wrote:

The failure is not related to devirtualization but the decision to not add type 
metadata to symbols local to TU seems to be an optimization that makes sense. 
Especially in the LTO context if most of the indirect calls can be optimized 
away if not all. I am willing to go with this fix to make sure we do not break 
the compiler due to verifier check failing for such cases and revisit if we 
must improve the handling of such cases from the call graph precision point of 
view.

https://github.com/llvm/llvm-project/pull/186272
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to