@@ -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
@@ -774,7 +778,11 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
774778 SchedBoundary *Zone) const {
775779 assert (Zone->isTop ());
776780 MachineInstr *CInst = Cand.SU ->getInstr ();
781+ if (!CInst)
782+ return false ;
777783 MachineInstr *TCInst = TryCand.SU ->getInstr ();
784+ if (!TCInst)
785+ return false ;
778786 const SIInstrInfo *TII = DAG->MF .getSubtarget <GCNSubtarget>().getInstrInfo ();
779787
780788 bool CandIsXDL = TII->isXDL (*CInst);
@@ -811,7 +819,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
811819 if (!CandSeenSuccs.insert (SuccSU).second )
812820 continue ;
813821
814- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
822+ MachineInstr *SuccMI = SuccSU->getInstr ();
823+ if (!SuccMI)
824+ continue ;
825+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
815826 ++CandReadyVALUSuccs;
816827 }
817828 }
@@ -822,7 +833,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
822833 if (!TrySeenSuccs.insert (SuccSU).second )
823834 continue ;
824835
825- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
836+ MachineInstr *SuccMI = SuccSU->getInstr ();
837+ if (!SuccMI)
838+ continue ;
839+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
826840 ++TryReadyVALUSuccs;
827841 }
828842 }
@@ -858,15 +872,21 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
858872 SUnit *SuccSU = Succ.getSUnit ();
859873 if (!CandSeenSuccs.insert (SuccSU).second )
860874 continue ;
861- if (TII->isVALU (*SuccSU->getInstr ()))
875+ MachineInstr *SuccMI = SuccSU->getInstr ();
876+ if (!SuccMI)
877+ continue ;
878+ if (TII->isVALU (*SuccMI))
862879 ++CandVALUSuccs;
863880 }
864881
865882 for (SDep &Succ : TryCand.SU ->Succs ) {
866883 SUnit *SuccSU = Succ.getSUnit ();
867884 if (!TrySeenSuccs.insert (SuccSU).second )
868885 continue ;
869- if (TII->isVALU (*SuccSU->getInstr ()))
886+ MachineInstr *SuccMI = SuccSU->getInstr ();
887+ if (!SuccMI)
888+ continue ;
889+ if (TII->isVALU (*SuccMI))
870890 ++TryVALUSuccs;
871891 }
872892
@@ -908,7 +928,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
908928 if (!CandSeenSuccs.insert (SuccSU).second )
909929 continue ;
910930
911- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
931+ MachineInstr *SuccMI = SuccSU->getInstr ();
932+ if (!SuccMI)
933+ continue ;
934+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
912935 ++CandReadyVALUSuccs;
913936 }
914937 }
@@ -919,7 +942,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
919942 if (!TrySeenSuccs.insert (SuccSU).second )
920943 continue ;
921944
922- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
945+ MachineInstr *SuccMI = SuccSU->getInstr ();
946+ if (!SuccMI)
947+ continue ;
948+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
923949 ++TryReadyVALUSuccs;
924950 }
925951 }
@@ -958,7 +984,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
958984 if (!CandSeenSuccs.insert (SuccSU).second )
959985 continue ;
960986
961- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
987+ MachineInstr *SuccMI = SuccSU->getInstr ();
988+ if (!SuccMI)
989+ continue ;
990+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
962991 ++CandReadyVALUSuccs;
963992 }
964993 }
@@ -969,7 +998,10 @@ bool GCNSchedStrategy::tryXDL(SchedCandidate &Cand, SchedCandidate &TryCand,
969998 if (!TrySeenSuccs.insert (SuccSU).second )
970999 continue ;
9711000
972- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
1001+ MachineInstr *SuccMI = SuccSU->getInstr ();
1002+ if (!SuccMI)
1003+ continue ;
1004+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
9731005 ++TryReadyVALUSuccs;
9741006 }
9751007 }
@@ -2783,7 +2815,9 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
27832815#endif
27842816
27852817 const SIInstrInfo *TII = static_cast <const SIInstrInfo *>(DAG->TII );
2786- bool IsXDL = TII->isXDL (*SU->getInstr ());
2818+ MachineInstr *MI = SU->getInstr ();
2819+ bool IsXDL = MI ? TII->isXDL (*SU->getInstr ()) : false ;
2820+ bool IsALU = MI ? TII->isVALU (*SU->getInstr ()) || TII->isSALU (*SU->getInstr ()) : false ;
27872821 unsigned Cycles = SU->Latency ;
27882822 if (IsXDL) {
27892823 // FIXME: Hack since XDL is only actually occupying for 24 cycles with 8
@@ -2792,8 +2826,10 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
27922826 Cycles -= 2 ;
27932827 XDLProcRes.reset ();
27942828 XDLProcRes.reserve (Cycles);
2795- } else {
2829+ } else if (IsALU) {
27962830 XDLProcRes.release (Cycles);
2831+ } else {
2832+ XDLProcRes.release (1 );
27972833 }
27982834
27992835 LLVM_DEBUG (dbgs () << " OldXDLProcRes: " << XDLCyclesBefore
@@ -2809,7 +2845,11 @@ SUnit *GCNPostSchedStrategy::pickNode(bool &IsTopNode) {
28092845bool GCNPostSchedStrategy::tryXDL (SchedCandidate &Cand,
28102846 SchedCandidate &TryCand) {
28112847 MachineInstr *CInst = Cand.SU ->getInstr ();
2848+ if (!CInst)
2849+ return false ;
28122850 MachineInstr *TCInst = TryCand.SU ->getInstr ();
2851+ if (!TCInst)
2852+ return false ;
28132853 const SIInstrInfo *TII = DAG->MF .getSubtarget <GCNSubtarget>().getInstrInfo ();
28142854
28152855 bool CandIsXDL = TII->isXDL (*CInst);
@@ -2846,7 +2886,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
28462886 if (!CandSeenSuccs.insert (SuccSU).second )
28472887 continue ;
28482888
2849- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
2889+ MachineInstr *SuccMI = SuccSU->getInstr ();
2890+ if (!SuccMI)
2891+ continue ;
2892+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
28502893 ++CandReadyVALUSuccs;
28512894 }
28522895 }
@@ -2857,7 +2900,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
28572900 if (!TrySeenSuccs.insert (SuccSU).second )
28582901 continue ;
28592902
2860- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
2903+ MachineInstr *SuccMI = SuccSU->getInstr ();
2904+ if (!SuccMI)
2905+ continue ;
2906+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
28612907 ++TryReadyVALUSuccs;
28622908 }
28632909 }
@@ -2893,15 +2939,21 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
28932939 SUnit *SuccSU = Succ.getSUnit ();
28942940 if (!CandSeenSuccs.insert (SuccSU).second )
28952941 continue ;
2896- if (TII->isVALU (*SuccSU->getInstr ()))
2942+ MachineInstr *SuccMI = SuccSU->getInstr ();
2943+ if (!SuccMI)
2944+ continue ;
2945+ if (TII->isVALU (*SuccMI))
28972946 ++CandVALUSuccs;
28982947 }
28992948
29002949 for (SDep &Succ : TryCand.SU ->Succs ) {
29012950 SUnit *SuccSU = Succ.getSUnit ();
29022951 if (!TrySeenSuccs.insert (SuccSU).second )
29032952 continue ;
2904- if (TII->isVALU (*SuccSU->getInstr ()))
2953+ MachineInstr *SuccMI = SuccSU->getInstr ();
2954+ if (!SuccMI)
2955+ continue ;
2956+ if (TII->isVALU (*SuccMI))
29052957 ++TryVALUSuccs;
29062958 }
29072959
@@ -2943,7 +2995,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29432995 if (!CandSeenSuccs.insert (SuccSU).second )
29442996 continue ;
29452997
2946- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
2998+ MachineInstr *SuccMI = SuccSU->getInstr ();
2999+ if (!SuccMI)
3000+ continue ;
3001+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
29473002 ++CandReadyVALUSuccs;
29483003 }
29493004 }
@@ -2954,7 +3009,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29543009 if (!TrySeenSuccs.insert (SuccSU).second )
29553010 continue ;
29563011
2957- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3012+ MachineInstr *SuccMI = SuccSU->getInstr ();
3013+ if (!SuccMI)
3014+ continue ;
3015+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
29583016 ++TryReadyVALUSuccs;
29593017 }
29603018 }
@@ -2993,7 +3051,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
29933051 if (!CandSeenSuccs.insert (SuccSU).second )
29943052 continue ;
29953053
2996- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3054+ MachineInstr *SuccMI = SuccSU->getInstr ();
3055+ if (!SuccMI)
3056+ continue ;
3057+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
29973058 ++CandReadyVALUSuccs;
29983059 }
29993060 }
@@ -3004,7 +3065,10 @@ bool GCNPostSchedStrategy::tryXDL(SchedCandidate &Cand,
30043065 if (!TrySeenSuccs.insert (SuccSU).second )
30053066 continue ;
30063067
3007- if (TII->isVALU (*SuccSU->getInstr ()) && SuccSU->NumPredsLeft == 1 ) {
3068+ MachineInstr *SuccMI = SuccSU->getInstr ();
3069+ if (!SuccMI)
3070+ continue ;
3071+ if (TII->isVALU (*SuccMI) && SuccSU->NumPredsLeft == 1 ) {
30083072 ++TryReadyVALUSuccs;
30093073 }
30103074 }
0 commit comments