[llvm] [PGO][ICP] Prevent indirect call promotion to functions with incompatible target features (PR #192142)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 12:11:39 PDT 2026


================
@@ -666,10 +666,16 @@ CallBase &llvm::pgo::promoteIndirectCall(CallBase &CB, Function *DirectCallee,
                                          uint64_t Count, uint64_t TotalCount,
                                          bool AttachProfToDirectCall,
                                          OptimizationRemarkEmitter *ORE) {
+  bool WasProfilePromoted = CB.getMetadata(LLVMContext::MD_prof) != nullptr;
+
   CallBase &NewInst = promoteCallWithIfThenElse(
       CB, DirectCallee,
       createBranchWeights(CB.getContext(), Count, TotalCount - Count));
 
+  if (WasProfilePromoted) {
+    NewInst.setMetadata("prof_promoted", MDNode::get(CB.getContext(), {}));
----------------
teresajohnson wrote:

Why is this needed if promotion is blocked?

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


More information about the llvm-commits mailing list