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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 11:55:59 PDT 2023


nikic 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;
----------------
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.


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

https://reviews.llvm.org/D148877



More information about the llvm-commits mailing list