[PATCH] Fix backtracking of instruction scheduling (pre-RA-sched)

Paweł Bylica chfast at gmail.com
Mon Mar 23 10:51:58 PDT 2015


This patch fixes a bug in instruction scheduling backtracking code.
https://llvm.org/bugs/show_bug.cgi?id=22304

It can happen (by line `CurSU->isPending = true;  // This SU is not in AvailableQueue right now.`) that a SUnit is mark as available but is not in the AvailableQueue. For SUnit being selected for scheduling both conditions must be met.

This patch mainly defensively protects from invalid removing a node from a queue. For noob like be this isAvailable flag and being in the AvailableQueue decoherence is annoying but maybe I don't have a full picture. I tried to synchronize that but it breaks the whole scheduling algorithm.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8556

Files:
  lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

Index: lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -1423,9 +1423,10 @@
 
       // If one or more successors has been unscheduled, then the current
       // node is no longer available.
-      if (!TrySU->isAvailable)
+      if (!TrySU->isAvailable || !TrySU->NodeQueueId)
         CurSU = AvailableQueue->pop();
       else {
+        // Available and in AvailableQueue
         AvailableQueue->remove(TrySU);
         CurSU = TrySU;
       }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8556.22486.patch
Type: text/x-patch
Size: 621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150323/1454f08d/attachment.bin>


More information about the llvm-commits mailing list