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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 02:55:22 PDT 2023


================
@@ -682,7 +683,8 @@ class TargetInstrInfo : public MCInstrInfo {
   /// If \p BytesRemoved is non-null, report the change in code size from the
   /// removed instructions.
   virtual unsigned removeBranch(MachineBasicBlock &MBB,
-                                int *BytesRemoved = nullptr) const {
+                                int *BytesRemoved = nullptr,
----------------
jayfoad wrote:

You could put `Indexes` _before_ `BytesAdded`/`BytesRemoved`, since only one client (BranchRelaxation) cares about the latter. But I guess it doesn't matter.

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


More information about the llvm-commits mailing list