@@ -14906,20 +14906,18 @@ SDValue DAGCombiner::reduceLoadWidth(SDNode *N) {
1490614906 if (ExtType == ISD::NON_EXTLOAD) {
1490714907 const MDNode *OldRanges = LN0->getRanges();
1490814908 const MDNode *NewRanges = nullptr;
14909- /* If LSBs are loaded and the truncated ConstantRange for the OldRanges
14910- metadata is not the full-set for the NewWidth then create a NewRanges
14911- metadata for the truncated load */
14909+ // If LSBs are loaded and the truncated ConstantRange for the OldRanges
14910+ // metadata is not the full-set for the NewWidth then create a NewRanges
14911+ // metadata for the truncated load
1491214912 if (ShAmt == 0 && OldRanges) {
14913- Type *NewTy = VT.getTypeForEVT(*DAG.getContext());
14914- const unsigned NewWidth = NewTy->getIntegerBitWidth();
14915- const ConstantRange CR = getConstantRangeFromMetadata(*OldRanges);
14916- const ConstantRange TruncatedCR = CR.truncate(NewWidth);
14913+ ConstantRange CR = getConstantRangeFromMetadata(*OldRanges);
14914+ ConstantRange TruncatedCR = CR.truncate(VT.getScalarSizeInBits());
1491714915
1491814916 if (!TruncatedCR.isFullSet()) {
1491914917 Metadata *Bounds[2] = {ConstantAsMetadata::get(ConstantInt::get(
14920- NewTy , TruncatedCR.getLower())),
14918+ *DAG.getContext() , TruncatedCR.getLower())),
1492114919 ConstantAsMetadata::get(ConstantInt::get(
14922- NewTy , TruncatedCR.getUpper()))};
14920+ *DAG.getContext() , TruncatedCR.getUpper()))};
1492314921 NewRanges = MDNode::get(*DAG.getContext(), Bounds);
1492414922 }
1492514923 }
0 commit comments