@@ -118,7 +118,12 @@ namespace {
118118 // / SimplifyDemandedBits - Check the specified integer node value to see if
119119 // / it can be simplified or if things it uses can be simplified by bit
120120 // / 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);
122127
123128 bool CombineToPreIndexedLoadStore (SDNode *N);
124129 bool CombineToPostIndexedLoadStore (SDNode *N);
@@ -534,10 +539,9 @@ SDOperand DAGCombiner::CombineTo(SDNode *N, const SDOperand *To, unsigned NumTo,
534539// / SimplifyDemandedBits - Check the specified integer node value to see if
535540// / it can be simplified or if things it uses can be simplified by bit
536541// / propagation. If so, return true.
537- bool DAGCombiner::SimplifyDemandedBits (SDOperand Op, uint64_t Demanded) {
542+ bool DAGCombiner::SimplifyDemandedBits (SDOperand Op, const APInt & Demanded) {
538543 TargetLowering::TargetLoweringOpt TLO (DAG, AfterLegalize);
539- uint64_t KnownZero, KnownOne;
540- Demanded &= MVT::getIntVTBitMask (Op.getValueType ());
544+ APInt KnownZero, KnownOne;
541545 if (!TLI.SimplifyDemandedBits (Op, Demanded, KnownZero, KnownOne, TLO))
542546 return false ;
543547
@@ -4501,7 +4505,10 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) {
45014505
45024506 // Otherwise, see if we can simplify the operation with
45034507 // 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 ()))))
45054512 return SDOperand (N, 0 );
45064513 }
45074514
0 commit comments