Index: llvm/lib/CodeGen/MacroFusion.cpp =================================================================== --- llvm/lib/CodeGen/MacroFusion.cpp +++ llvm/lib/CodeGen/MacroFusion.cpp @@ -71,6 +71,13 @@ 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 data dependencies from the FirstSU and dependencies + // of the SecondSU both dependent on other chained instructions, to prevent + // them from being scheduled into these chained instructions. + assert(hasLessThanNumFused(FirstSU, 2) && + "Chain two instructions together at most"); + // Adjust the latency between both instrs. for (SDep &SI : FirstSU.Succs) if (SI.getSUnit() == &SecondSU)