@@ -2256,7 +2256,7 @@ class BitPermutationSelector {
2256
2256
}
2257
2257
2258
2258
// Instruction selection for the 32-bit case.
2259
- SDNode * Select32 (SDNode *N, bool LateMask, unsigned *InstCnt) {
2259
+ SDValue Select32 (SDNode *N, bool LateMask, unsigned *InstCnt) {
2260
2260
SDLoc dl (N);
2261
2261
SDValue Res;
2262
2262
@@ -2337,7 +2337,7 @@ class BitPermutationSelector {
2337
2337
ANDIVal, ANDISVal), 0 );
2338
2338
}
2339
2339
2340
- return Res. getNode () ;
2340
+ return Res;
2341
2341
}
2342
2342
2343
2343
unsigned SelectRotMask64Count (unsigned RLAmt, bool Repl32,
@@ -2642,7 +2642,7 @@ class BitPermutationSelector {
2642
2642
}
2643
2643
2644
2644
// Instruction selection for the 64-bit case.
2645
- SDNode * Select64 (SDNode *N, bool LateMask, unsigned *InstCnt) {
2645
+ SDValue Select64 (SDNode *N, bool LateMask, unsigned *InstCnt) {
2646
2646
SDLoc dl (N);
2647
2647
SDValue Res;
2648
2648
@@ -2782,14 +2782,14 @@ class BitPermutationSelector {
2782
2782
}
2783
2783
}
2784
2784
2785
- return Res. getNode () ;
2785
+ return Res;
2786
2786
}
2787
2787
2788
- SDNode * Select (SDNode *N, bool LateMask, unsigned *InstCnt = nullptr ) {
2788
+ SDValue Select (SDNode *N, bool LateMask, unsigned *InstCnt = nullptr ) {
2789
2789
// Fill in BitGroups.
2790
2790
collectBitGroups (LateMask);
2791
2791
if (BitGroups.empty ())
2792
- return nullptr ;
2792
+ return SDValue () ;
2793
2793
2794
2794
// For 64-bit values, figure out when we can use 32-bit instructions.
2795
2795
if (Bits.size () == 64 )
@@ -2805,7 +2805,7 @@ class BitPermutationSelector {
2805
2805
return Select64 (N, LateMask, InstCnt);
2806
2806
}
2807
2807
2808
- return nullptr ;
2808
+ return SDValue () ;
2809
2809
}
2810
2810
2811
2811
void eraseMatchingBitGroups (function_ref<bool (const BitGroup &)> F) {
@@ -2831,12 +2831,12 @@ class BitPermutationSelector {
2831
2831
// Here we try to match complex bit permutations into a set of
2832
2832
// rotate-and-shift/shift/and/or instructions, using a set of heuristics
2833
2833
// known to produce optimal code for common cases (like i32 byte swapping).
2834
- SDNode * Select (SDNode *N) {
2834
+ SDValue Select (SDNode *N) {
2835
2835
Memoizer.clear ();
2836
2836
auto Result =
2837
2837
getValueBits (SDValue (N, 0 ), N->getValueType (0 ).getSizeInBits ());
2838
2838
if (!Result.first )
2839
- return nullptr ;
2839
+ return SDValue () ;
2840
2840
Bits = std::move (*Result.second );
2841
2841
2842
2842
LLVM_DEBUG (dbgs () << " Considering bit-permutation-based instruction"
@@ -2859,21 +2859,21 @@ class BitPermutationSelector {
2859
2859
2860
2860
unsigned InstCnt = 0 , InstCntLateMask = 0 ;
2861
2861
LLVM_DEBUG (dbgs () << " \t Early masking:\n " );
2862
- SDNode *RN = Select (N, false , &InstCnt);
2862
+ SDValue RV = Select (N, false , &InstCnt);
2863
2863
LLVM_DEBUG (dbgs () << " \t\t isel would use " << InstCnt << " instructions\n " );
2864
2864
2865
2865
LLVM_DEBUG (dbgs () << " \t Late masking:\n " );
2866
- SDNode *RNLM = Select (N, true , &InstCntLateMask);
2866
+ SDValue RVLM = Select (N, true , &InstCntLateMask);
2867
2867
LLVM_DEBUG (dbgs () << " \t\t isel would use " << InstCntLateMask
2868
2868
<< " instructions\n " );
2869
2869
2870
2870
if (InstCnt <= InstCntLateMask) {
2871
2871
LLVM_DEBUG (dbgs () << " \t Using early-masking for isel\n " );
2872
- return RN ;
2872
+ return RV ;
2873
2873
}
2874
2874
2875
2875
LLVM_DEBUG (dbgs () << " \t Using late-masking for isel\n " );
2876
- return RNLM ;
2876
+ return RVLM ;
2877
2877
}
2878
2878
};
2879
2879
@@ -4104,8 +4104,9 @@ bool PPCDAGToDAGISel::tryBitPermutation(SDNode *N) {
4104
4104
case ISD::AND:
4105
4105
case ISD::OR: {
4106
4106
BitPermutationSelector BPS (CurDAG);
4107
- if (SDNode *New = BPS.Select (N)) {
4108
- ReplaceNode (N, New);
4107
+ if (SDValue New = BPS.Select (N)) {
4108
+ CurDAG->ReplaceAllUsesWith (N, &New);
4109
+ CurDAG->RemoveDeadNode (N);
4109
4110
return true ;
4110
4111
}
4111
4112
return false ;
0 commit comments