@@ -509,7 +509,9 @@ SUnit *GCNSchedStrategy::pickNode(bool &IsTopNode) {
509509#endif
510510
511511 const SIInstrInfo *TII = static_cast <const SIInstrInfo *>(DAG->TII );
512- bool IsXDL = TII->isXDL (*SU->getInstr ());
512+ MachineInstr *MI = SU->getInstr ();
513+ bool IsXDL = MI ? TII->isXDL (*SU->getInstr ()) : false ;
514+ bool IsALU = MI ? TII->isVALU (*SU->getInstr ()) || TII->isSALU (*SU->getInstr ()) : false ;
513515 unsigned Cycles = SU->Latency ;
514516 if (IsXDL) {
515517 // FIXME: Hack since XDL is only actually occupying for 24 cycles with 8
@@ -518,8 +520,10 @@ SUnit *GCNSchedStrategy::pickNode(bool &IsTopNode) {
518520 Cycles -= 2 ;
519521 XDLProcRes.reset ();
520522 XDLProcRes.reserve (Cycles);
521- } else {
523+ } else if (IsALU) {
522524 XDLProcRes.release (Cycles);
525+ } else {
526+ XDLProcRes.release (1 );
523527 }
524528
525529 LLVM_DEBUG (dbgs () << " OldXDLProcRes: " << XDLCyclesBefore
@@ -786,7 +790,11 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
786790 SchedBoundary *Zone) const {
787791 assert (Zone->isTop ());
788792 MachineInstr *CInst = Cand.SU ->getInstr ();
793+ if (!CInst)
794+ return false ;
789795 MachineInstr *TCInst = TryCand.SU ->getInstr ();
796+ if (!TCInst)
797+ return false ;
790798 const SIInstrInfo *TII = DAG->MF .getSubtarget <GCNSubtarget>().getInstrInfo ();
791799
792800 bool CandIsXDL = TII->isXDL (*CInst);
@@ -823,7 +831,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
823831 if (!CandSeenSuccs.insert (SuccSU).second )
824832 continue ;
825833
826- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
834+ MachineInstr *SuccMI = SuccSU->getInstr ();
835+ if (!SuccMI)
836+ continue ;
837+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
827838 ++CandReadyVALUSuccs;
828839 }
829840 }
@@ -834,7 +845,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
834845 if (!TrySeenSuccs.insert (SuccSU).second )
835846 continue ;
836847
837- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
848+ MachineInstr *SuccMI = SuccSU->getInstr ();
849+ if (!SuccMI)
850+ continue ;
851+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
838852 ++TryReadyVALUSuccs;
839853 }
840854 }
@@ -870,15 +884,21 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
870884 SUnit *SuccSU = Succ.getSUnit ();
871885 if (!CandSeenSuccs.insert (SuccSU).second )
872886 continue ;
873- if (TII->isVALU (*SuccSU->getInstr ()))
887+ MachineInstr *SuccMI = SuccSU->getInstr ();
888+ if (!SuccMI)
889+ continue ;
890+ if (TII->isVALU (*SuccMI))
874891 ++CandVALUSuccs;
875892 }
876893
877894 for (SDep &Succ : TryCand.SU ->Succs ) {
878895 SUnit *SuccSU = Succ.getSUnit ();
879896 if (!TrySeenSuccs.insert (SuccSU).second )
880897 continue ;
881- if (TII->isVALU (*SuccSU->getInstr ()))
898+ MachineInstr *SuccMI = SuccSU->getInstr ();
899+ if (!SuccMI)
900+ continue ;
901+ if (TII->isVALU (*SuccMI))
882902 ++TryVALUSuccs;
883903 }
884904
@@ -920,7 +940,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
920940 if (!CandSeenSuccs.insert (SuccSU).second )
921941 continue ;
922942
923- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
943+ MachineInstr *SuccMI = SuccSU->getInstr ();
944+ if (!SuccMI)
945+ continue ;
946+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
924947 ++CandReadyVALUSuccs;
925948 }
926949 }
@@ -931,7 +954,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
931954 if (!TrySeenSuccs.insert (SuccSU).second )
932955 continue ;
933956
934- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
957+ MachineInstr *SuccMI = SuccSU->getInstr ();
958+ if (!SuccMI)
959+ continue ;
960+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
935961 ++TryReadyVALUSuccs;
936962 }
937963 }
@@ -970,7 +996,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
970996 if (!CandSeenSuccs.insert (SuccSU).second )
971997 continue ;
972998
973- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
999+ MachineInstr *SuccMI = SuccSU->getInstr ();
1000+ if (!SuccMI)
1001+ continue ;
1002+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
9741003 ++CandReadyVALUSuccs;
9751004 }
9761005 }
@@ -981,7 +1010,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
9811010 if (!TrySeenSuccs.insert (SuccSU).second )
9821011 continue ;
9831012
984- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
1013+ MachineInstr *SuccMI = SuccSU->getInstr ();
1014+ if (!SuccMI)
1015+ continue ;
1016+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
9851017 ++TryReadyVALUSuccs;
9861018 }
9871019 }
@@ -2795,7 +2827,9 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
27952827#endif
27962828
27972829 const SIInstrInfo *TII = static_cast <const SIInstrInfo *>(DAG->TII );
2798- bool IsXDL = TII->isXDL (*SU->getInstr ());
2830+ MachineInstr *MI = SU->getInstr ();
2831+ bool IsXDL = MI ? TII->isXDL (*SU->getInstr ()) : false ;
2832+ bool IsALU = MI ? TII->isVALU (*SU->getInstr ()) || TII->isSALU (*SU->getInstr ()) : false ;
27992833 unsigned Cycles = SU->Latency ;
28002834 if (IsXDL) {
28012835 // FIXME: Hack since XDL is only actually occupying for 24 cycles with 8
@@ -2804,8 +2838,10 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
28042838 Cycles -= 2 ;
28052839 XDLProcRes.reset ();
28062840 XDLProcRes.reserve (Cycles);
2807- } else {
2841+ } else if (IsALU) {
28082842 XDLProcRes.release (Cycles);
2843+ } else {
2844+ XDLProcRes.release (1 );
28092845 }
28102846
28112847 LLVM_DEBUG (dbgs () << " OldXDLProcRes: " << XDLCyclesBefore
@@ -2821,7 +2857,11 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
28212857bool GCNPostSchedStrategy::tryXDL (SchedCandidate &Cand,
28222858 SchedCandidate &TryCand) {
28232859 MachineInstr *CInst = Cand.SU ->getInstr ();
2860+ if (!CInst)
2861+ return false ;
28242862 MachineInstr *TCInst = TryCand.SU ->getInstr ();
2863+ if (!TCInst)
2864+ return false ;
28252865 const SIInstrInfo *TII = DAG->MF .getSubtarget <GCNSubtarget>().getInstrInfo ();
28262866
28272867 bool CandIsXDL = TII->isXDL (*CInst);
@@ -2858,7 +2898,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
28582898 if (!CandSeenSuccs.insert (SuccSU).second )
28592899 continue ;
28602900
2861- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
2901+ MachineInstr *SuccMI = SuccSU->getInstr ();
2902+ if (!SuccMI)
2903+ continue ;
2904+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
28622905 ++CandReadyVALUSuccs;
28632906 }
28642907 }
@@ -2869,7 +2912,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
28692912 if (!TrySeenSuccs.insert (SuccSU).second )
28702913 continue ;
28712914
2872- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
2915+ MachineInstr *SuccMI = SuccSU->getInstr ();
2916+ if (!SuccMI)
2917+ continue ;
2918+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
28732919 ++TryReadyVALUSuccs;
28742920 }
28752921 }
@@ -2905,15 +2951,21 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29052951 SUnit *SuccSU = Succ.getSUnit ();
29062952 if (!CandSeenSuccs.insert (SuccSU).second )
29072953 continue ;
2908- if (TII->isVALU (*SuccSU->getInstr ()))
2954+ MachineInstr *SuccMI = SuccSU->getInstr ();
2955+ if (!SuccMI)
2956+ continue ;
2957+ if (TII->isVALU (*SuccMI))
29092958 ++CandVALUSuccs;
29102959 }
29112960
29122961 for (SDep &Succ : TryCand.SU ->Succs ) {
29132962 SUnit *SuccSU = Succ.getSUnit ();
29142963 if (!TrySeenSuccs.insert (SuccSU).second )
29152964 continue ;
2916- if (TII->isVALU (*SuccSU->getInstr ()))
2965+ MachineInstr *SuccMI = SuccSU->getInstr ();
2966+ if (!SuccMI)
2967+ continue ;
2968+ if (TII->isVALU (*SuccMI))
29172969 ++TryVALUSuccs;
29182970 }
29192971
@@ -2955,7 +3007,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29553007 if (!CandSeenSuccs.insert (SuccSU).second )
29563008 continue ;
29573009
2958- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3010+ MachineInstr *SuccMI = SuccSU->getInstr ();
3011+ if (!SuccMI)
3012+ continue ;
3013+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
29593014 ++CandReadyVALUSuccs;
29603015 }
29613016 }
@@ -2966,7 +3021,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29663021 if (!TrySeenSuccs.insert (SuccSU).second )
29673022 continue ;
29683023
2969- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3024+ MachineInstr *SuccMI = SuccSU->getInstr ();
3025+ if (!SuccMI)
3026+ continue ;
3027+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
29703028 ++TryReadyVALUSuccs;
29713029 }
29723030 }
@@ -3005,7 +3063,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
30053063 if (!CandSeenSuccs.insert (SuccSU).second )
30063064 continue ;
30073065
3008- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3066+ MachineInstr *SuccMI = SuccSU->getInstr ();
3067+ if (!SuccMI)
3068+ continue ;
3069+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
30093070 ++CandReadyVALUSuccs;
30103071 }
30113072 }
@@ -3016,7 +3077,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
30163077 if (!TrySeenSuccs.insert (SuccSU).second )
30173078 continue ;
30183079
3019- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3080+ MachineInstr *SuccMI = SuccSU->getInstr ();
3081+ if (!SuccMI)
3082+ continue ;
3083+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
30203084 ++TryReadyVALUSuccs;
30213085 }
30223086 }
0 commit comments