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/MachineSink.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/MachineSink.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineSink.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index 7d0bedab..bdf1ef6 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -30,6 +30,7 @@ #include "llvm/CodeGen/MachineBlockFrequencyInfo.h" #include "llvm/CodeGen/MachineBranchProbabilityInfo.h" #include "llvm/CodeGen/MachineCycleAnalysis.h" +#include "llvm/CodeGen/MachineDomTreeUpdater.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -747,8 +748,11 @@ bool MachineSinking::runOnMachineFunction(MachineFunction &MF) { MadeChange |= ProcessBlock(MBB); // If we have anything we marked as toSplit, split it now. + MachineDomTreeUpdater MDTU(DT, PDT, + MachineDomTreeUpdater::UpdateStrategy::Lazy); for (const auto &Pair : ToSplit) { - auto NewSucc = Pair.first->SplitCriticalEdge(Pair.second, *this); + auto NewSucc = + Pair.first->SplitCriticalEdge(Pair.second, *this, nullptr, &MDTU); if (NewSucc != nullptr) { LLVM_DEBUG(dbgs() << " *** Splitting critical edge: " << printMBBReference(*Pair.first) << " -- " |