[llvm] [BranchRelaxation] Remove quadratic behavior in relaxation pass (PR #96250)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 17:27:11 PDT 2024


================
@@ -384,11 +391,17 @@ bool BranchRelaxation::fixupConditionalBranch(MachineInstr &MI) {
 
   auto finalizeBlockChanges = [&](MachineBasicBlock *MBB,
                                   MachineBasicBlock *NewBB) {
-    // Keep the block offsets up to date.
-    adjustBlockOffsets(*MBB);
+    if (NewBB == nullptr)
+      return;
----------------
minglotus-6 wrote:

nit: now `MBB` is not used and `finalizeBlockChanges` processes block changes around `NewBB` (including its prev and next). Remove unused `MBB` parameter and optionally rename `finalizeBlockChanges` to something like `finalizeBlockChangesForNewBB` to make code around the call-site clearer.

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


More information about the llvm-commits mailing list