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

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 00:18:33 PDT 2023


================
@@ -156,12 +156,14 @@ void ilist_traits<MachineInstr>::addNodeToList(MachineInstr *N) {
   MachineFunction *MF = Parent->getParent();
   N->addRegOperandsToUseLists(MF->getRegInfo());
   MF->handleInsertion(*N);
+  Parent->noteInsertion(*N);
----------------
perlfu wrote:

I have changed this to be a delegate of `MachineFunction`.

I was wary that `MachineFunction` only admits a single delegate, so we might overlap with another user.
However looking at it again, the only user I can see is GlobalISel, and this shouldn't overlap.
I guess we could always extend `MachineFunction` in the future to allow multiple delegates.

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


More information about the llvm-commits mailing list