@@ -481,31 +481,6 @@ static bool canEvaluateShifted(Value *V, unsigned NumBits, bool IsLeftShift,
481
481
Instruction *I = dyn_cast<Instruction>(V);
482
482
if (!I) return false ;
483
483
484
- // If this is the opposite shift, we can directly reuse the input of the shift
485
- // if the needed bits are already zero in the input. This allows us to reuse
486
- // the value which means that we don't care if the shift has multiple uses.
487
- // TODO: Handle opposite shift by exact value.
488
- ConstantInt *CI = nullptr ;
489
- if ((IsLeftShift && match (I, m_LShr (m_Value (), m_ConstantInt (CI)))) ||
490
- (!IsLeftShift && match (I, m_Shl (m_Value (), m_ConstantInt (CI))))) {
491
- if (CI->getValue () == NumBits) {
492
- // TODO: Check that the input bits are already zero with MaskedValueIsZero
493
- #if 0
494
- // If this is a truncate of a logical shr, we can truncate it to a smaller
495
- // lshr iff we know that the bits we would otherwise be shifting in are
496
- // already zeros.
497
- uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();
498
- uint32_t BitWidth = Ty->getScalarSizeInBits();
499
- if (MaskedValueIsZero(I->getOperand(0),
500
- APInt::getHighBitsSet(OrigBitWidth, OrigBitWidth-BitWidth)) &&
501
- CI->getLimitedValue(BitWidth) < BitWidth) {
502
- return CanEvaluateTruncated(I->getOperand(0), Ty);
503
- }
504
- #endif
505
-
506
- }
507
- }
508
-
509
484
// We can't mutate something that has multiple uses: doing so would
510
485
// require duplicating the instruction in general, which isn't profitable.
511
486
if (!I->hasOneUse ()) return false ;
0 commit comments