[PATCH] D148877: [PGO]Implement metadata combine for 'branch_weights' of direct callsites

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 12:14:07 PDT 2023


davidxl added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:2721
+      case LLVMContext::MD_prof:
+        K->setMetadata(Kind, MDNode::getMergedProfMetadata(KMD, JMD, K, J));
+        break;
----------------
nikic wrote:
> This should probably be behind a DoesKMove check? If we're CSEing with a dominating call, it doesn't make sense to add the branch weights, as the second call is being removed.
> 
> I'd suggest adding a test with a readonly/nounwind/willreturn call being GVNed to cover that case.
good catch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148877/new/

https://reviews.llvm.org/D148877



More information about the llvm-commits mailing list