[PATCH] D156837: [AArch64][CodeGen] Avoid inverting hot branches during relaxation

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 14:56:49 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/BranchRelaxation.cpp:187
+  // function.
+  for (MachineBasicBlock &MBB : reverse(*MF)) {
+    if (MBB.getSectionID() != MBBSectionID::ColdSectionID) {
----------------
this just scanned through the function, couldn't you track this on that first loop?


================
Comment at: llvm/lib/CodeGen/BranchRelaxation.cpp:406-430
+  if (MBB->getSectionID() != TBB->getSectionID() &&
+      TBB->getSectionID() == MBBSectionID::ColdSectionID &&
+      TrampolineInsertionPoint != nullptr) {
+    // If the insertion point is out of range, we can't put a trampoline there.
+    NewBB =
+        createNewBlockAfter(*TrampolineInsertionPoint, MBB->getBasicBlock());
+
----------------
Split this into a helper function?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156837



More information about the llvm-commits mailing list