diff options
author | paperchalice <liujunchang97@outlook.com> | 2024-07-11 11:08:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-11 11:08:05 +0800 |
commit | c5e5088033fed170068d818c54af6862e449b545 (patch) | |
tree | d6a55ba547c8a29981fb179d5680e97da8d53113 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | cb3bc5be9c20d893adf94cdf436092657ab5ab40 (diff) | |
download | llvm-c5e5088033fed170068d818c54af6862e449b545.zip llvm-c5e5088033fed170068d818c54af6862e449b545.tar.gz llvm-c5e5088033fed170068d818c54af6862e449b545.tar.bz2 |
[CodeGen] Remove `applySplitCriticalEdges` in `MachineDominatorTree` (#97055)
Summary:
- Remove wrappers in `MachineDominatorTree`.
- Remove `MachineDominatorTree` update code in
`MachineBasicBlock::SplitCriticalEdge`.
- Use `MachineDomTreeUpdater` in passes which call
`MachineBasicBlock::SplitCriticalEdge` and preserve
`MachineDominatorTreeWrapperPass` or CFG analyses.
Commit abea99f65a97248974c02a5544eaf25fc4240056 introduced related
methods in 2014. Now we have SemiNCA based dominator tree in 2017 and
dominator tree updater, the solution adopted here seems a bit outdated.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 5fe7a9d..131220a 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -16,11 +16,13 @@ #include "llvm/CodeGen/LiveIntervals.h" #include "llvm/CodeGen/LivePhysRegs.h" #include "llvm/CodeGen/LiveVariables.h" +#include "llvm/CodeGen/MachineDomTreeUpdater.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineLoopInfo.h" +#include "llvm/CodeGen/MachinePostDominators.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SlotIndexes.h" #include "llvm/CodeGen/TargetInstrInfo.h" @@ -1339,9 +1341,17 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge( LIS->repairIntervalsInRange(this, getFirstTerminator(), end(), UsedRegs); } - if (auto *MDTWrapper = - P.getAnalysisIfAvailable<MachineDominatorTreeWrapperPass>()) - MDTWrapper->getDomTree().recordSplitCriticalEdge(this, Succ, NMBB); + auto *MDTWrapper = + P.getAnalysisIfAvailable<MachineDominatorTreeWrapperPass>(); + auto *MPDTWrapper = + P.getAnalysisIfAvailable<MachinePostDominatorTreeWrapperPass>(); + auto *MDT = MDTWrapper ? &MDTWrapper->getDomTree() : nullptr; + auto *MPDT = MPDTWrapper ? &MPDTWrapper->getPostDomTree() : nullptr; + MachineDomTreeUpdater MDTU(MDT, MPDT, + MachineDomTreeUpdater::UpdateStrategy::Eager); + MDTU.applyUpdates({{MachineDominatorTree::Insert, this, NMBB}, + {MachineDominatorTree::Insert, NMBB, Succ}, + {MachineDominatorTree::Delete, this, Succ}}); auto *MLIWrapper = P.getAnalysisIfAvailable<MachineLoopInfoWrapperPass>(); if (MachineLoopInfo *MLI = MLIWrapper ? &MLIWrapper->getLI() : nullptr) |