[PATCH] D36704: [CodeGen] Improve the consistency of instruction fusion
Evandro Menezes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 16 13:42:05 PDT 2017
evandro updated this revision to Diff 111417.
evandro retitled this revision from "[CodeGen] Minimize the dependency graph of fused instructions" to "[CodeGen] Improve the consistency of instruction fusion".
evandro edited the summary of this revision.
evandro removed a subscriber: hiraditya.
evandro added a comment.
Expand the scope of the patch to make it more generic.
https://reviews.llvm.org/D36704
Files:
llvm/lib/CodeGen/MacroFusion.cpp
Index: llvm/lib/CodeGen/MacroFusion.cpp
===================================================================
--- llvm/lib/CodeGen/MacroFusion.cpp
+++ llvm/lib/CodeGen/MacroFusion.cpp
@@ -57,16 +57,29 @@
dbgs() << DAG.TII->getName(FirstSU.getInstr()->getOpcode()) << " - " <<
DAG.TII->getName(SecondSU.getInstr()->getOpcode()) << '\n'; );
- if (&SecondSU != &DAG.ExitSU)
- // Make instructions dependent on FirstSU also dependent on SecondSU to
- // prevent them from being scheduled between FirstSU and and SecondSU.
- for (const SDep &SI : FirstSU.Succs) {
- if (SI.getSUnit() == &SecondSU)
- continue;
- DEBUG(dbgs() << " Copy Succ ";
- SI.getSUnit()->print(dbgs(), &DAG); dbgs() << '\n';);
- DAG.addEdge(SI.getSUnit(), SDep(&SecondSU, SDep::Artificial));
- }
+ // Make data dependencies from the FirstSU also dependent on the SecondSU to
+ // prevent them from being scheduled between the FirstSU and the SecondSU.
+ for (const SDep &SI : FirstSU.Succs) {
+ SUnit *SU = SI.getSUnit();
+ if (SI.isCtrl() || SU == &SecondSU || SecondSU.isPred(SU))
+ continue;
+ DEBUG(dbgs() << " Bind ";
+ SecondSU.print(dbgs(), &DAG); dbgs() << " - ";
+ SU->print(dbgs(), &DAG); dbgs() << '\n';);
+ DAG.addEdge(SU, SDep(&SecondSU, SDep::Artificial));
+ }
+
+ // 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.isCtrl() || SU == &FirstSU || FirstSU.isPred(SU))
+ continue;
+ DEBUG(dbgs() << " Bind ";
+ SU->print(dbgs(), &DAG); dbgs() << " - ";
+ FirstSU.print(dbgs(), &DAG); dbgs() << '\n';);
+ DAG.addEdge(&FirstSU, SDep(SU, SDep::Artificial));
+ }
++NumFused;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36704.111417.patch
Type: text/x-patch
Size: 1892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170816/bc9a3397/attachment-0001.bin>
More information about the llvm-commits
mailing list