@@ -505,7 +505,9 @@ SUnit *GCNSchedStrategy::pickNode(bool &IsTopNode) {
505505#endif
506506
507507 const SIInstrInfo *TII = static_cast <const SIInstrInfo *>(DAG->TII );
508- bool IsXDL = TII->isXDL (*SU->getInstr ());
508+ MachineInstr *MI = SU->getInstr ();
509+ bool IsXDL = MI ? TII->isXDL (*SU->getInstr ()) : false ;
510+ bool IsALU = MI ? TII->isVALU (*SU->getInstr ()) || TII->isSALU (*SU->getInstr ()) : false ;
509511 unsigned Cycles = SU->Latency ;
510512 if (IsXDL) {
511513 // FIXME: Hack since XDL is only actually occupying for 24 cycles with 8
@@ -514,8 +516,10 @@ SUnit *GCNSchedStrategy::pickNode(bool &IsTopNode) {
514516 Cycles -= 2 ;
515517 XDLProcRes.reset ();
516518 XDLProcRes.reserve (Cycles);
517- } else {
519+ } else if (IsALU) {
518520 XDLProcRes.release (Cycles);
521+ } else {
522+ XDLProcRes.release (1 );
519523 }
520524
521525 LLVM_DEBUG (dbgs () << " OldXDLProcRes: " << XDLCyclesBefore
@@ -776,7 +780,11 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
776780 SchedBoundary *Zone) const {
777781 assert (Zone->isTop ());
778782 MachineInstr *CInst = Cand.SU ->getInstr ();
783+ if (!CInst)
784+ return false ;
779785 MachineInstr *TCInst = TryCand.SU ->getInstr ();
786+ if (!TCInst)
787+ return false ;
780788 const SIInstrInfo *TII = DAG->MF .getSubtarget <GCNSubtarget>().getInstrInfo ();
781789
782790 bool CandIsXDL = TII->isXDL (*CInst);
@@ -813,7 +821,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
813821 if (!CandSeenSuccs.insert (SuccSU).second )
814822 continue ;
815823
816- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
824+ MachineInstr *SuccMI = SuccSU->getInstr ();
825+ if (!SuccMI)
826+ continue ;
827+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
817828 ++CandReadyVALUSuccs;
818829 }
819830 }
@@ -824,7 +835,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
824835 if (!TrySeenSuccs.insert (SuccSU).second )
825836 continue ;
826837
827- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
838+ MachineInstr *SuccMI = SuccSU->getInstr ();
839+ if (!SuccMI)
840+ continue ;
841+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
828842 ++TryReadyVALUSuccs;
829843 }
830844 }
@@ -860,15 +874,21 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
860874 SUnit *SuccSU = Succ.getSUnit ();
861875 if (!CandSeenSuccs.insert (SuccSU).second )
862876 continue ;
863- if (TII->isVALU (*SuccSU->getInstr ()))
877+ MachineInstr *SuccMI = SuccSU->getInstr ();
878+ if (!SuccMI)
879+ continue ;
880+ if (TII->isVALU (*SuccMI))
864881 ++CandVALUSuccs;
865882 }
866883
867884 for (SDep &Succ : TryCand.SU ->Succs ) {
868885 SUnit *SuccSU = Succ.getSUnit ();
869886 if (!TrySeenSuccs.insert (SuccSU).second )
870887 continue ;
871- if (TII->isVALU (*SuccSU->getInstr ()))
888+ MachineInstr *SuccMI = SuccSU->getInstr ();
889+ if (!SuccMI)
890+ continue ;
891+ if (TII->isVALU (*SuccMI))
872892 ++TryVALUSuccs;
873893 }
874894
@@ -910,7 +930,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
910930 if (!CandSeenSuccs.insert (SuccSU).second )
911931 continue ;
912932
913- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
933+ MachineInstr *SuccMI = SuccSU->getInstr ();
934+ if (!SuccMI)
935+ continue ;
936+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
914937 ++CandReadyVALUSuccs;
915938 }
916939 }
@@ -921,7 +944,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
921944 if (!TrySeenSuccs.insert (SuccSU).second )
922945 continue ;
923946
924- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
947+ MachineInstr *SuccMI = SuccSU->getInstr ();
948+ if (!SuccMI)
949+ continue ;
950+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
925951 ++TryReadyVALUSuccs;
926952 }
927953 }
@@ -960,7 +986,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
960986 if (!CandSeenSuccs.insert (SuccSU).second )
961987 continue ;
962988
963- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
989+ MachineInstr *SuccMI = SuccSU->getInstr ();
990+ if (!SuccMI)
991+ continue ;
992+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
964993 ++CandReadyVALUSuccs;
965994 }
966995 }
@@ -971,7 +1000,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
9711000 if (!TrySeenSuccs.insert (SuccSU).second )
9721001 continue ;
9731002
974- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
1003+ MachineInstr *SuccMI = SuccSU->getInstr ();
1004+ if (!SuccMI)
1005+ continue ;
1006+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
9751007 ++TryReadyVALUSuccs;
9761008 }
9771009 }
@@ -2796,7 +2828,9 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
27962828#endif
27972829
27982830 const SIInstrInfo *TII = static_cast <const SIInstrInfo *>(DAG->TII );
2799- bool IsXDL = TII->isXDL (*SU->getInstr ());
2831+ MachineInstr *MI = SU->getInstr ();
2832+ bool IsXDL = MI ? TII->isXDL (*SU->getInstr ()) : false ;
2833+ bool IsALU = MI ? TII->isVALU (*SU->getInstr ()) || TII->isSALU (*SU->getInstr ()) : false ;
28002834 unsigned Cycles = SU->Latency ;
28012835 if (IsXDL) {
28022836 // FIXME: Hack since XDL is only actually occupying for 24 cycles with 8
@@ -2805,8 +2839,10 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
28052839 Cycles -= 2 ;
28062840 XDLProcRes.reset ();
28072841 XDLProcRes.reserve (Cycles);
2808- } else {
2842+ } else if (IsALU) {
28092843 XDLProcRes.release (Cycles);
2844+ } else {
2845+ XDLProcRes.release (1 );
28102846 }
28112847
28122848 LLVM_DEBUG (dbgs () << " OldXDLProcRes: " << XDLCyclesBefore
@@ -2822,7 +2858,11 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
28222858bool GCNPostSchedStrategy::tryXDL (SchedCandidate &Cand,
28232859 SchedCandidate &TryCand) {
28242860 MachineInstr *CInst = Cand.SU ->getInstr ();
2861+ if (!CInst)
2862+ return false ;
28252863 MachineInstr *TCInst = TryCand.SU ->getInstr ();
2864+ if (!TCInst)
2865+ return false ;
28262866 const SIInstrInfo *TII = DAG->MF .getSubtarget <GCNSubtarget>().getInstrInfo ();
28272867
28282868 bool CandIsXDL = TII->isXDL (*CInst);
@@ -2859,7 +2899,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
28592899 if (!CandSeenSuccs.insert (SuccSU).second )
28602900 continue ;
28612901
2862- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
2902+ MachineInstr *SuccMI = SuccSU->getInstr ();
2903+ if (!SuccMI)
2904+ continue ;
2905+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
28632906 ++CandReadyVALUSuccs;
28642907 }
28652908 }
@@ -2870,7 +2913,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
28702913 if (!TrySeenSuccs.insert (SuccSU).second )
28712914 continue ;
28722915
2873- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
2916+ MachineInstr *SuccMI = SuccSU->getInstr ();
2917+ if (!SuccMI)
2918+ continue ;
2919+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
28742920 ++TryReadyVALUSuccs;
28752921 }
28762922 }
@@ -2906,15 +2952,21 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29062952 SUnit *SuccSU = Succ.getSUnit ();
29072953 if (!CandSeenSuccs.insert (SuccSU).second )
29082954 continue ;
2909- if (TII->isVALU (*SuccSU->getInstr ()))
2955+ MachineInstr *SuccMI = SuccSU->getInstr ();
2956+ if (!SuccMI)
2957+ continue ;
2958+ if (TII->isVALU (*SuccMI))
29102959 ++CandVALUSuccs;
29112960 }
29122961
29132962 for (SDep &Succ : TryCand.SU ->Succs ) {
29142963 SUnit *SuccSU = Succ.getSUnit ();
29152964 if (!TrySeenSuccs.insert (SuccSU).second )
29162965 continue ;
2917- if (TII->isVALU (*SuccSU->getInstr ()))
2966+ MachineInstr *SuccMI = SuccSU->getInstr ();
2967+ if (!SuccMI)
2968+ continue ;
2969+ if (TII->isVALU (*SuccMI))
29182970 ++TryVALUSuccs;
29192971 }
29202972
@@ -2956,7 +3008,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29563008 if (!CandSeenSuccs.insert (SuccSU).second )
29573009 continue ;
29583010
2959- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3011+ MachineInstr *SuccMI = SuccSU->getInstr ();
3012+ if (!SuccMI)
3013+ continue ;
3014+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
29603015 ++CandReadyVALUSuccs;
29613016 }
29623017 }
@@ -2967,7 +3022,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29673022 if (!TrySeenSuccs.insert (SuccSU).second )
29683023 continue ;
29693024
2970- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3025+ MachineInstr *SuccMI = SuccSU->getInstr ();
3026+ if (!SuccMI)
3027+ continue ;
3028+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
29713029 ++TryReadyVALUSuccs;
29723030 }
29733031 }
@@ -3006,7 +3064,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
30063064 if (!CandSeenSuccs.insert (SuccSU).second )
30073065 continue ;
30083066
3009- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3067+ MachineInstr *SuccMI = SuccSU->getInstr ();
3068+ if (!SuccMI)
3069+ continue ;
3070+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
30103071 ++CandReadyVALUSuccs;
30113072 }
30123073 }
@@ -3017,7 +3078,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
30173078 if (!TrySeenSuccs.insert (SuccSU).second )
30183079 continue ;
30193080
3020- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3081+ MachineInstr *SuccMI = SuccSU->getInstr ();
3082+ if (!SuccMI)
3083+ continue ;
3084+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
30213085 ++TryReadyVALUSuccs;
30223086 }
30233087 }
0 commit comments