@@ -2711,11 +2711,10 @@ CheckOpcode(const unsigned char *MatcherTable, unsigned &MatcherIndex,
2711
2711
return N->getOpcode () == Opc;
2712
2712
}
2713
2713
2714
- LLVM_ATTRIBUTE_ALWAYS_INLINE static bool
2715
- CheckType (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N,
2716
- const TargetLowering *TLI, const DataLayout &DL) {
2717
- MVT::SimpleValueType VT =
2718
- static_cast <MVT::SimpleValueType>(MatcherTable[MatcherIndex++]);
2714
+ LLVM_ATTRIBUTE_ALWAYS_INLINE static bool CheckType (MVT::SimpleValueType VT,
2715
+ SDValue N,
2716
+ const TargetLowering *TLI,
2717
+ const DataLayout &DL) {
2719
2718
if (N.getValueType () == VT)
2720
2719
return true ;
2721
2720
@@ -2724,13 +2723,11 @@ CheckType(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N,
2724
2723
}
2725
2724
2726
2725
LLVM_ATTRIBUTE_ALWAYS_INLINE static bool
2727
- CheckChildType (const unsigned char *MatcherTable, unsigned &MatcherIndex,
2728
- SDValue N, const TargetLowering *TLI, const DataLayout &DL,
2729
- unsigned ChildNo) {
2726
+ CheckChildType (MVT::SimpleValueType VT, SDValue N, const TargetLowering *TLI,
2727
+ const DataLayout &DL, unsigned ChildNo) {
2730
2728
if (ChildNo >= N.getNumOperands ())
2731
- return false ; // Match fails if out of range child #.
2732
- return ::CheckType (MatcherTable, MatcherIndex, N.getOperand (ChildNo), TLI,
2733
- DL);
2729
+ return false ; // Match fails if out of range child #.
2730
+ return ::CheckType (VT, N.getOperand (ChildNo), TLI, DL);
2734
2731
}
2735
2732
2736
2733
LLVM_ATTRIBUTE_ALWAYS_INLINE static bool
@@ -2829,7 +2826,8 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
2829
2826
bool &Result,
2830
2827
const SelectionDAGISel &SDISel,
2831
2828
SmallVectorImpl<std::pair<SDValue, SDNode*>> &RecordedNodes) {
2832
- switch (Table[Index++]) {
2829
+ unsigned Opcode = Table[Index++];
2830
+ switch (Opcode) {
2833
2831
default :
2834
2832
Result = false ;
2835
2833
return Index-1 ; // Could not evaluate this predicate.
@@ -2856,12 +2854,27 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
2856
2854
Result = !::CheckOpcode (Table, Index, N.getNode ());
2857
2855
return Index;
2858
2856
case SelectionDAGISel::OPC_CheckType:
2859
- Result = !::CheckType (Table, Index, N, SDISel.TLI ,
2860
- SDISel.CurDAG ->getDataLayout ());
2857
+ case SelectionDAGISel::OPC_CheckTypeI32:
2858
+ case SelectionDAGISel::OPC_CheckTypeI64: {
2859
+ MVT::SimpleValueType VT;
2860
+ switch (Opcode) {
2861
+ case SelectionDAGISel::OPC_CheckTypeI32:
2862
+ VT = MVT::i32 ;
2863
+ break ;
2864
+ case SelectionDAGISel::OPC_CheckTypeI64:
2865
+ VT = MVT::i64 ;
2866
+ break ;
2867
+ default :
2868
+ VT = static_cast <MVT::SimpleValueType>(Table[Index++]);
2869
+ break ;
2870
+ }
2871
+ Result = !::CheckType (VT, N, SDISel.TLI , SDISel.CurDAG ->getDataLayout ());
2861
2872
return Index;
2873
+ }
2862
2874
case SelectionDAGISel::OPC_CheckTypeRes: {
2863
2875
unsigned Res = Table[Index++];
2864
- Result = !::CheckType (Table, Index, N.getValue (Res), SDISel.TLI ,
2876
+ Result = !::CheckType (static_cast <MVT::SimpleValueType>(Table[Index++]),
2877
+ N.getValue (Res), SDISel.TLI ,
2865
2878
SDISel.CurDAG ->getDataLayout ());
2866
2879
return Index;
2867
2880
}
@@ -2872,11 +2885,13 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
2872
2885
case SelectionDAGISel::OPC_CheckChild4Type:
2873
2886
case SelectionDAGISel::OPC_CheckChild5Type:
2874
2887
case SelectionDAGISel::OPC_CheckChild6Type:
2875
- case SelectionDAGISel::OPC_CheckChild7Type:
2876
- Result = !::CheckChildType (
2877
- Table, Index, N, SDISel.TLI , SDISel.CurDAG ->getDataLayout (),
2878
- Table[Index - 1 ] - SelectionDAGISel::OPC_CheckChild0Type);
2888
+ case SelectionDAGISel::OPC_CheckChild7Type: {
2889
+ Result =
2890
+ !::CheckChildType (static_cast <MVT::SimpleValueType>(Table[Index++]), N,
2891
+ SDISel.TLI , SDISel.CurDAG ->getDataLayout (),
2892
+ Opcode - SelectionDAGISel::OPC_CheckChild0Type);
2879
2893
return Index;
2894
+ }
2880
2895
case SelectionDAGISel::OPC_CheckCondCode:
2881
2896
Result = !::CheckCondCode (Table, Index, N);
2882
2897
return Index;
@@ -3306,15 +3321,29 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
3306
3321
continue ;
3307
3322
3308
3323
case OPC_CheckType:
3309
- if (!::CheckType (MatcherTable, MatcherIndex, N, TLI,
3310
- CurDAG->getDataLayout ()))
3324
+ case OPC_CheckTypeI32:
3325
+ case OPC_CheckTypeI64:
3326
+ MVT::SimpleValueType VT;
3327
+ switch (Opcode) {
3328
+ case OPC_CheckTypeI32:
3329
+ VT = MVT::i32 ;
3330
+ break ;
3331
+ case OPC_CheckTypeI64:
3332
+ VT = MVT::i64 ;
3333
+ break ;
3334
+ default :
3335
+ VT = static_cast <MVT::SimpleValueType>(MatcherTable[MatcherIndex++]);
3336
+ break ;
3337
+ }
3338
+ if (!::CheckType (VT, N, TLI, CurDAG->getDataLayout ()))
3311
3339
break ;
3312
3340
continue ;
3313
3341
3314
3342
case OPC_CheckTypeRes: {
3315
3343
unsigned Res = MatcherTable[MatcherIndex++];
3316
- if (!::CheckType (MatcherTable, MatcherIndex, N.getValue (Res), TLI,
3317
- CurDAG->getDataLayout ()))
3344
+ if (!::CheckType (
3345
+ static_cast <MVT::SimpleValueType>(MatcherTable[MatcherIndex++]),
3346
+ N.getValue (Res), TLI, CurDAG->getDataLayout ()))
3318
3347
break ;
3319
3348
continue ;
3320
3349
}
@@ -3387,9 +3416,9 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
3387
3416
case OPC_CheckChild2Type: case OPC_CheckChild3Type:
3388
3417
case OPC_CheckChild4Type: case OPC_CheckChild5Type:
3389
3418
case OPC_CheckChild6Type: case OPC_CheckChild7Type:
3390
- if (!::CheckChildType (MatcherTable, MatcherIndex, N, TLI,
3391
- CurDAG-> getDataLayout ( ),
3392
- Opcode - OPC_CheckChild0Type))
3419
+ if (!::CheckChildType (
3420
+ static_cast <MVT::SimpleValueType>(MatcherTable[MatcherIndex++] ),
3421
+ N, TLI, CurDAG-> getDataLayout (), Opcode - OPC_CheckChild0Type))
3393
3422
break ;
3394
3423
continue ;
3395
3424
case OPC_CheckCondCode:
0 commit comments