diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp index d2ee21c8720f..2db1e86905a4 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp @@ -36,21 +36,6 @@ static bool isHazard(const SDep &Dep) { return Dep.getKind() == SDep::Anti || Dep.getKind() == SDep::Output; } -static SUnit *getPredClusterSU(const SUnit &SU) { - for (const SDep &SI : SU.Preds) - if (SI.isCluster()) - return SI.getSUnit(); - - return nullptr; -} - -static bool hasLessThanNumFused(const SUnit &SU, unsigned FuseLimit) { - unsigned Num = 1; - const SUnit *CurrentSU = &SU; - while ((CurrentSU = getPredClusterSU(*CurrentSU)) && Num < FuseLimit) Num ++; - return Num < FuseLimit; -} - static bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU, SUnit &SecondSU) { // Check that neither instr is already paired with another along the edge @@ -71,14 +56,6 @@ static bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU, if (!DAG.addEdge(&SecondSU, SDep(&FirstSU, SDep::Cluster))) return false; - // TODO - If we want to chain more than two instructions, we need to create - // artifical edges to make dependencies from the FirstSU also dependent - // on other chained instructions, and other chained instructions also - // dependent on the dependencies of the SecondSU, to prevent them from being - // scheduled into these chained instructions. - assert(hasLessThanNumFused(FirstSU, 2) && - "Currently we only support chaining together two instructions"); - // Adjust the latency between both instrs. for (SDep &SI : FirstSU.Succs) if (SI.getSUnit() == &SecondSU) @@ -184,10 +161,8 @@ bool MacroFusion::scheduleAdjacentImpl(ScheduleDAGInstrs &DAG, SUnit &AnchorSU) if (DepSU.isBoundaryNode()) continue; - // Only chain two instructions together at most. const MachineInstr *DepMI = DepSU.getInstr(); - if (!hasLessThanNumFused(DepSU, 2) || - !shouldScheduleAdjacent(TII, ST, DepMI, AnchorMI)) + if (!shouldScheduleAdjacent(TII, ST, DepMI, AnchorMI)) continue; if (fuseInstructionPair(DAG, DepSU, AnchorSU)) @@ -201,7 +176,7 @@ std::unique_ptr<ScheduleDAGMutation> llvm::createMacroFusionDAGMutation( ShouldSchedulePredTy shouldScheduleAdjacent) { if(EnableMacroFusion) - return std::make_unique<MacroFusion>(shouldScheduleAdjacent, true); + return llvm::make_unique<MacroFusion>(shouldScheduleAdjacent, true); return nullptr; } @@ -209,6 +184,6 @@ std::unique_ptr<ScheduleDAGMutation> llvm::createBranchMacroFusionDAGMutation( ShouldSchedulePredTy shouldScheduleAdjacent) { if(EnableMacroFusion) - return std::make_unique<MacroFusion>(shouldScheduleAdjacent, false); + return llvm::make_unique<MacroFusion>(shouldScheduleAdjacent, false); return nullptr; } |
