diff options
author | paperchalice <liujunchang97@outlook.com> | 2024-12-13 11:43:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-13 11:43:09 +0800 |
commit | 1562b70eaf6e0b95910fa684dfc53bd5ca6252e7 (patch) | |
tree | 415d937ed1f8667229f71565f4e93cdc7f1562f6 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | ada517b40c6f90a78ea69b9d2d0997c82065c9fd (diff) | |
download | llvm-1562b70eaf6e0b95910fa684dfc53bd5ca6252e7.zip llvm-1562b70eaf6e0b95910fa684dfc53bd5ca6252e7.tar.gz llvm-1562b70eaf6e0b95910fa684dfc53bd5ca6252e7.tar.bz2 |
Reapply "[DomTreeUpdater] Move critical edge splitting code to updater" (#119547)
This relands commit #115111.
Use traditional way to update post dominator tree, i.e. break critical
edge splitting into insert, insert, delete sequence.
When splitting critical edges, the post dominator tree may change its
root node, and `setNewRoot` only works in normal dominator tree...
See
https://github.com/llvm/llvm-project/blob/6c7e5827eda26990e872eb7c3f0d7866ee3c3171/llvm/include/llvm/Support/GenericDomTree.h#L684-L687
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 5d06af3e..5ac6472 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" @@ -1146,7 +1148,7 @@ public: MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge( MachineBasicBlock *Succ, Pass *P, MachineFunctionAnalysisManager *MFAM, - std::vector<SparseBitVector<>> *LiveInSets) { + std::vector<SparseBitVector<>> *LiveInSets, MachineDomTreeUpdater *MDTU) { assert((P || MFAM) && "Need a way to get analysis results!"); if (!canSplitCriticalEdge(Succ)) return nullptr; @@ -1346,8 +1348,8 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge( LIS->repairIntervalsInRange(this, getFirstTerminator(), end(), UsedRegs); } - if (auto *MDT = GET_RESULT(MachineDominatorTree, getDomTree, )) - MDT->recordSplitCriticalEdge(this, Succ, NMBB); + if (MDTU) + MDTU->splitCriticalEdge(this, Succ, NMBB); if (MachineLoopInfo *MLI = GET_RESULT(MachineLoop, getLI, Info)) if (MachineLoop *TIL = MLI->getLoopFor(this)) { |