Fix a bug in SelectionDAG scheduling backtracking code: PR22304.
authorAndrew Trick <atrick@apple.com>
Fri, 27 Mar 2015 03:44:13 +0000 (03:44 +0000)
committerAndrew Trick <atrick@apple.com>
Fri, 27 Mar 2015 03:44:13 +0000 (03:44 +0000)
commit18fc42ab127562b9063c19eb148ed2eff085c354
tree128195525b601f1c06100193c3f1910eff63d1ab
parentb3ad90eaccfa0a5ca51119395de624139ca630f7
Fix a bug in SelectionDAG scheduling backtracking code: PR22304.

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. Sometimes nodes are marked isAvailable but are not in
the queue because they have been defered due to some hazard.

Patch by Pawel Bylica!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233351 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
test/CodeGen/Generic/scheduler-backtracking.ll [new file with mode: 0644]