aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBlockPlacement.cpp
diff options
context:
space:
mode:
authorAlexis Engelke <engelke@in.tum.de>2024-08-08 08:53:45 +0200
committerGitHub <noreply@github.com>2024-08-08 08:53:45 +0200
commit862d822d83a5422e6cc966c3244e766dee6d45ba (patch)
treea619465388eda393cd24cddbcfdddd3df14dc121 /llvm/lib/CodeGen/MachineBlockPlacement.cpp
parent3606d69d0b57dc1d23a4362e376e7ad27f650c27 (diff)
downloadllvm-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.cpp6
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++) {