[llvm] [MachineBasicBlock] Fix use after free in SplitCriticalEdge (PR #66188)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 03:00:52 PDT 2023


================
@@ -693,15 +693,15 @@ void MachineBasicBlock::updateTerminator(
   MachineBasicBlock *TBB = nullptr, *FBB = nullptr;
   SmallVector<MachineOperand, 4> Cond;
   DebugLoc DL = findBranchDebugLoc();
-  bool B = TII->analyzeBranch(*this, TBB, FBB, Cond);
+  bool B = TII->analyzeBranch(*this, TBB, FBB, Cond, /*AllowModify=*/false);
   (void) B;
   assert(!B && "UpdateTerminators requires analyzable predecessors!");
   if (Cond.empty()) {
     if (TBB) {
       // The block has an unconditional branch. If its successor is now its
       // layout successor, delete the branch.
       if (isLayoutSuccessor(TBB))
-        TII->removeBranch(*this);
+        TII->removeBranch(*this, nullptr, Indexes);
----------------
qcolombet wrote:

Nit: `/*BytesRemoved=*/`

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


More information about the llvm-commits mailing list