Revert "[NFC][ScheduleDAG] Remove unused EntrySU SUnit"
This reverts commit 0345d88de654259ae90494bf9b015416e2cccacb.
Google internal backend uses EntrySU, we are looking into removing
dependency on it.
Differential Revision: https://reviews.llvm.org/D88018
diff --git a/llvm/lib/CodeGen/MacroFusion.cpp b/llvm/lib/CodeGen/MacroFusion.cpp
index 4243dcf..d2ee21c 100644
--- a/llvm/lib/CodeGen/MacroFusion.cpp
+++ b/llvm/lib/CodeGen/MacroFusion.cpp
@@ -109,21 +109,23 @@
// Make the FirstSU also dependent on the dependencies of the SecondSU to
// prevent them from being scheduled between the FirstSU and the SecondSU.
- for (const SDep &SI : SecondSU.Preds) {
- SUnit *SU = SI.getSUnit();
- if (SI.isWeak() || isHazard(SI) || &FirstSU == SU || FirstSU.isSucc(SU))
- continue;
- LLVM_DEBUG(dbgs() << " Bind "; DAG.dumpNodeName(*SU); dbgs() << " - ";
- DAG.dumpNodeName(FirstSU); dbgs() << '\n';);
- DAG.addEdge(&FirstSU, SDep(SU, SDep::Artificial));
- }
- // ExitSU comes last by design, which acts like an implicit dependency
- // between ExitSU and any bottom root in the graph. We should transfer
- // this to FirstSU as well.
- if (&SecondSU == &DAG.ExitSU) {
- for (SUnit &SU : DAG.SUnits) {
- if (SU.Succs.empty())
- DAG.addEdge(&FirstSU, SDep(&SU, SDep::Artificial));
+ if (&FirstSU != &DAG.EntrySU) {
+ for (const SDep &SI : SecondSU.Preds) {
+ SUnit *SU = SI.getSUnit();
+ if (SI.isWeak() || isHazard(SI) || &FirstSU == SU || FirstSU.isSucc(SU))
+ continue;
+ LLVM_DEBUG(dbgs() << " Bind "; DAG.dumpNodeName(*SU); dbgs() << " - ";
+ DAG.dumpNodeName(FirstSU); dbgs() << '\n';);
+ DAG.addEdge(&FirstSU, SDep(SU, SDep::Artificial));
+ }
+ // ExitSU comes last by design, which acts like an implicit dependency
+ // between ExitSU and any bottom root in the graph. We should transfer
+ // this to FirstSU as well.
+ if (&SecondSU == &DAG.ExitSU) {
+ for (SUnit &SU : DAG.SUnits) {
+ if (SU.Succs.empty())
+ DAG.addEdge(&FirstSU, SDep(&SU, SDep::Artificial));
+ }
}
}