@@ -118,7 +118,12 @@ namespace {
118
118
// / SimplifyDemandedBits - Check the specified integer node value to see if
119
119
// / it can be simplified or if things it uses can be simplified by bit
120
120
// / propagation. If so, return true.
121
- bool SimplifyDemandedBits (SDOperand Op, uint64_t Demanded = ~0ULL );
121
+ bool SimplifyDemandedBits (SDOperand Op) {
122
+ APInt Demanded = APInt::getAllOnesValue (Op.getValueSizeInBits ());
123
+ return SimplifyDemandedBits (Op, Demanded);
124
+ }
125
+
126
+ bool SimplifyDemandedBits (SDOperand Op, const APInt &Demanded);
122
127
123
128
bool CombineToPreIndexedLoadStore (SDNode *N);
124
129
bool CombineToPostIndexedLoadStore (SDNode *N);
@@ -534,10 +539,9 @@ SDOperand DAGCombiner::CombineTo(SDNode *N, const SDOperand *To, unsigned NumTo,
534
539
// / SimplifyDemandedBits - Check the specified integer node value to see if
535
540
// / it can be simplified or if things it uses can be simplified by bit
536
541
// / propagation. If so, return true.
537
- bool DAGCombiner::SimplifyDemandedBits (SDOperand Op, uint64_t Demanded) {
542
+ bool DAGCombiner::SimplifyDemandedBits (SDOperand Op, const APInt & Demanded) {
538
543
TargetLowering::TargetLoweringOpt TLO (DAG, AfterLegalize);
539
- uint64_t KnownZero, KnownOne;
540
- Demanded &= MVT::getIntVTBitMask (Op.getValueType ());
544
+ APInt KnownZero, KnownOne;
541
545
if (!TLI.SimplifyDemandedBits (Op, Demanded, KnownZero, KnownOne, TLO))
542
546
return false ;
543
547
@@ -4501,7 +4505,10 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) {
4501
4505
4502
4506
// Otherwise, see if we can simplify the operation with
4503
4507
// SimplifyDemandedBits, which only works if the value has a single use.
4504
- if (SimplifyDemandedBits (Value, MVT::getIntVTBitMask (ST->getMemoryVT ())))
4508
+ if (SimplifyDemandedBits (Value,
4509
+ APInt::getLowBitsSet (
4510
+ Value.getValueSizeInBits (),
4511
+ MVT::getSizeInBits (ST->getMemoryVT ()))))
4505
4512
return SDOperand (N, 0 );
4506
4513
}
4507
4514
0 commit comments