@@ -1322,12 +1322,11 @@ static void computeKnownBitsFromOperator(const Operator *I,
1322
1322
isa<ScalableVectorType>(I->getType ()))
1323
1323
break ;
1324
1324
1325
+ unsigned NumElts = DemandedElts.getBitWidth ();
1326
+ bool IsLE = Q.DL .isLittleEndian ();
1325
1327
// Look through a cast from narrow vector elements to wider type.
1326
1328
// Examples: v4i32 -> v2i64, v3i8 -> v24
1327
1329
unsigned SubBitWidth = SrcVecTy->getScalarSizeInBits ();
1328
- unsigned NumElts = DemandedElts.getBitWidth ();
1329
- unsigned SubScale = BitWidth / SubBitWidth;
1330
- bool isLE = Q.DL .isLittleEndian ();
1331
1330
if (BitWidth % SubBitWidth == 0 ) {
1332
1331
// Known bits are automatically intersected across demanded elements of a
1333
1332
// vector. So for example, if a bit is computed as known zero, it must be
@@ -1343,6 +1342,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
1343
1342
//
1344
1343
// The known bits of each sub-element are then inserted into place
1345
1344
// (dependent on endian) to form the full result of known bits.
1345
+ unsigned SubScale = BitWidth / SubBitWidth;
1346
1346
APInt SubDemandedElts = APInt::getZero (NumElts * SubScale);
1347
1347
for (unsigned i = 0 ; i != NumElts; ++i) {
1348
1348
if (DemandedElts[i])
@@ -1353,12 +1353,13 @@ static void computeKnownBitsFromOperator(const Operator *I,
1353
1353
for (unsigned i = 0 ; i != SubScale; ++i) {
1354
1354
computeKnownBits (I->getOperand (0 ), SubDemandedElts.shl (i), KnownSrc,
1355
1355
Depth + 1 , Q);
1356
- unsigned ShiftElt = isLE ? i : SubScale - 1 - i;
1356
+ unsigned ShiftElt = IsLE ? i : SubScale - 1 - i;
1357
1357
Known.insertBits (KnownSrc, ShiftElt * SubBitWidth);
1358
1358
}
1359
1359
}
1360
1360
1361
1361
if (SubBitWidth % BitWidth == 0 ) {
1362
+ unsigned SubScale = SubBitWidth / BitWidth;
1362
1363
KnownBits KnownSrc (SubBitWidth);
1363
1364
APInt SubDemandedElts =
1364
1365
APIntOps::ScaleBitMask (DemandedElts, NumElts / SubScale);
@@ -1369,7 +1370,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
1369
1370
Known.One .setAllBits ();
1370
1371
for (unsigned i = 0 ; i != SubScale; ++i) {
1371
1372
if (DemandedElts[i]) {
1372
- unsigned Shifts = isLE ? i : NumElts - 1 - i;
1373
+ unsigned Shifts = IsLE ? i : NumElts - 1 - i;
1373
1374
unsigned Offset = (Shifts % SubScale) * BitWidth;
1374
1375
Known = Known.intersectWith (KnownSrc.extractBits (BitWidth, Offset));
1375
1376
if (Known.isUnknown ())
0 commit comments