[PATCH] D25140: ScheduleDAGInstrs: Add condjump deps in addSchedBarrierDeps()

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 16:35:33 PDT 2016


MatzeB created this revision.
MatzeB added reviewers: atrick, kparzysz, jonpa, tstellarAMD, volkan.
MatzeB added a subscriber: llvm-commits.
MatzeB set the repository for this revision to rL LLVM.
Herald added subscribers: wdng, mcrosier.

addSchedBarrierDeps() is supposed to add use operands to the ExitSU
node. The current implementation adds uses for calls/barrier instruction
and the MBB live-outs in all other cases. The use
operands of conditional jump instructions were missed.

(I'd also find adding the live-outs of the basic block questionable as I would assume it to be more likely a value is not used immediately, but we can have that discussion another day)


Repository:
  rL LLVM

https://reviews.llvm.org/D25140

Files:
  lib/CodeGen/ScheduleDAGInstrs.cpp


Index: lib/CodeGen/ScheduleDAGInstrs.cpp
===================================================================
--- lib/CodeGen/ScheduleDAGInstrs.cpp
+++ lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -247,11 +247,8 @@
 void ScheduleDAGInstrs::addSchedBarrierDeps() {
   MachineInstr *ExitMI = RegionEnd != BB->end() ? &*RegionEnd : nullptr;
   ExitSU.setInstr(ExitMI);
-  bool AllDepKnown = ExitMI &&
-    (ExitMI->isCall() || ExitMI->isBarrier());
-  if (ExitMI && AllDepKnown) {
-    // If it's a call or a barrier, add dependencies on the defs and uses of
-    // instruction.
+  // Add dependencies on the defs and uses of the instruction.
+  if (ExitMI) {
     for (const MachineOperand &MO : ExitMI->operands()) {
       if (!MO.isReg() || MO.isDef()) continue;
       unsigned Reg = MO.getReg();
@@ -262,10 +259,10 @@
       else if (MO.readsReg()) // ignore undef operands
         addVRegUseDeps(&ExitSU, ExitMI->getOperandNo(&MO));
     }
-  } else {
+  }
+  if (!ExitMI || (!ExitMI->isCall() && !ExitMI->isBarrier())) {
     // For others, e.g. fallthrough, conditional branch, assume the exit
     // uses all the registers that are livein to the successor blocks.
-    assert(Uses.empty() && "Uses in set before adding deps?");
     for (const MachineBasicBlock *Succ : BB->successors()) {
       for (const auto &LI : Succ->liveins()) {
         if (!Uses.contains(LI.PhysReg))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25140.73160.patch
Type: text/x-patch
Size: 1380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160930/3723c627/attachment.bin>


More information about the llvm-commits mailing list