diff options
author | Alexis Engelke <engelke@in.tum.de> | 2024-08-08 08:53:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-08 08:53:45 +0200 |
commit | 862d822d83a5422e6cc966c3244e766dee6d45ba (patch) | |
tree | a619465388eda393cd24cddbcfdddd3df14dc121 /llvm/lib/CodeGen/MachineBlockPlacement.cpp | |
parent | 3606d69d0b57dc1d23a4362e376e7ad27f650c27 (diff) | |
download | llvm-862d822d83a5422e6cc966c3244e766dee6d45ba.zip llvm-862d822d83a5422e6cc966c3244e766dee6d45ba.tar.gz llvm-862d822d83a5422e6cc966c3244e766dee6d45ba.tar.bz2 |
[CodeGen] Don't renumber invalid domtree (#102427)
Machine block placement might remove nodes from the function but does
not update the dominator tree accordingly. Instead of renumbering (which
might crash due to accessing removed blocks), set the domtree to null to
make clear that it is invalid at this point.
Fixup of #102107.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBlockPlacement.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index 9010c3c..be783bc 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -3649,7 +3649,11 @@ void MachineBlockPlacement::assignBlockOrder( const std::vector<const MachineBasicBlock *> &NewBlockOrder) { assert(F->size() == NewBlockOrder.size() && "Incorrect size of block order"); F->RenumberBlocks(); - MPDT->updateBlockNumbers(); + // At this point, we possibly removed blocks from the function, so we can't + // renumber the domtree. At this point, we don't need it anymore, though. + // TODO: move this to the point where the dominator tree is actually + // invalidated (i.e., where blocks are removed without updating the domtree). + MPDT = nullptr; bool HasChanges = false; for (size_t I = 0; I < NewBlockOrder.size(); I++) { |