[PATCH] D47984: AMDGPU/SI: Fix two missing NodeNum checks for SISched

Axel Davy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 9 10:45:33 PDT 2018


axeldavy created this revision.
axeldavy added a reviewer: arsenm.
axeldavy added a project: AMDGPU.
Herald added subscribers: llvm-commits, javed.absar, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, kzhuravl, MatzeB.

SIScheduleDAGMI::moveLowLatencies was potentially calling isLowLatencyInstruction for SUs with NodeNum >= DAGSize, which is illegal.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99994


Repository:
  rL LLVM

https://reviews.llvm.org/D47984

Files:
  lib/Target/AMDGPU/SIMachineScheduler.cpp


Index: lib/Target/AMDGPU/SIMachineScheduler.cpp
===================================================================
--- lib/Target/AMDGPU/SIMachineScheduler.cpp
+++ lib/Target/AMDGPU/SIMachineScheduler.cpp
@@ -1842,11 +1842,11 @@
 
     for (SDep& PredDep : SU->Preds) {
       SUnit *Pred = PredDep.getSUnit();
+      if (Pred->NodeNum >= DAGSize)
+        continue;
       if (SITII->isLowLatencyInstruction(*Pred->getInstr())) {
         IsLowLatencyUser = true;
       }
-      if (Pred->NodeNum >= DAGSize)
-        continue;
       unsigned PredPos = ScheduledSUnitsInv[Pred->NodeNum];
       if (PredPos >= MinPos)
         MinPos = PredPos + 1;
@@ -1877,7 +1877,8 @@
       bool CopyForLowLat = false;
       for (SDep& SuccDep : SU->Succs) {
         SUnit *Succ = SuccDep.getSUnit();
-        if (SITII->isLowLatencyInstruction(*Succ->getInstr())) {
+        if (Succ->NodeNum < DAGSize &&
+            SITII->isLowLatencyInstruction(*Succ->getInstr())) {
           CopyForLowLat = true;
         }
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47984.150631.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180609/072e3c55/attachment.bin>


More information about the llvm-commits mailing list