Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/MacroFusion.cpp
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | for (const SDep &SI : FirstSU.Succs) { | ||||
continue; | continue; | ||||
LLVM_DEBUG(dbgs() << " Bind "; DAG.dumpNodeName(SecondSU); | LLVM_DEBUG(dbgs() << " Bind "; DAG.dumpNodeName(SecondSU); | ||||
dbgs() << " - "; DAG.dumpNodeName(*SU); dbgs() << '\n';); | dbgs() << " - "; DAG.dumpNodeName(*SU); dbgs() << '\n';); | ||||
DAG.addEdge(SU, SDep(&SecondSU, SDep::Artificial)); | DAG.addEdge(SU, SDep(&SecondSU, SDep::Artificial)); | ||||
} | } | ||||
// Make the FirstSU also dependent on the dependencies of the SecondSU to | // Make the FirstSU also dependent on the dependencies of the SecondSU to | ||||
// prevent them from being scheduled between the FirstSU and the SecondSU. | // prevent them from being scheduled between the FirstSU and the SecondSU. | ||||
if (&FirstSU != &DAG.EntrySU) { | |||||
for (const SDep &SI : SecondSU.Preds) { | for (const SDep &SI : SecondSU.Preds) { | ||||
SUnit *SU = SI.getSUnit(); | SUnit *SU = SI.getSUnit(); | ||||
if (SI.isWeak() || isHazard(SI) || &FirstSU == SU || FirstSU.isSucc(SU)) | if (SI.isWeak() || isHazard(SI) || &FirstSU == SU || FirstSU.isSucc(SU)) | ||||
continue; | continue; | ||||
LLVM_DEBUG(dbgs() << " Bind "; DAG.dumpNodeName(*SU); dbgs() << " - "; | LLVM_DEBUG(dbgs() << " Bind "; DAG.dumpNodeName(*SU); dbgs() << " - "; | ||||
DAG.dumpNodeName(FirstSU); dbgs() << '\n';); | DAG.dumpNodeName(FirstSU); dbgs() << '\n';); | ||||
DAG.addEdge(&FirstSU, SDep(SU, SDep::Artificial)); | DAG.addEdge(&FirstSU, SDep(SU, SDep::Artificial)); | ||||
} | } | ||||
// ExitSU comes last by design, which acts like an implicit dependency | // ExitSU comes last by design, which acts like an implicit dependency | ||||
// between ExitSU and any bottom root in the graph. We should transfer | // between ExitSU and any bottom root in the graph. We should transfer | ||||
// this to FirstSU as well. | // this to FirstSU as well. | ||||
if (&SecondSU == &DAG.ExitSU) { | if (&SecondSU == &DAG.ExitSU) { | ||||
for (SUnit &SU : DAG.SUnits) { | for (SUnit &SU : DAG.SUnits) { | ||||
if (SU.Succs.empty()) | if (SU.Succs.empty()) | ||||
DAG.addEdge(&FirstSU, SDep(&SU, SDep::Artificial)); | DAG.addEdge(&FirstSU, SDep(&SU, SDep::Artificial)); | ||||
} | } | ||||
} | } | ||||
} | |||||
++NumFused; | ++NumFused; | ||||
return true; | return true; | ||||
} | } | ||||
namespace { | namespace { | ||||
/// Post-process the DAG to create cluster edges between instrs that may | /// Post-process the DAG to create cluster edges between instrs that may | ||||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |