Skip to content

Commit 4ce6114

Browse files
committed
[InstCombine] canEvaluateShifted - remove dead (and never used code). NFC.
This was already #if'd out when it was added back in 2010 at rG18d7fc8fc6767 and has never been touched since.
1 parent 9d63029 commit 4ce6114

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -481,31 +481,6 @@ static bool canEvaluateShifted(Value *V, unsigned NumBits, bool IsLeftShift,
481481
Instruction *I = dyn_cast<Instruction>(V);
482482
if (!I) return false;
483483

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-
509484
// We can't mutate something that has multiple uses: doing so would
510485
// require duplicating the instruction in general, which isn't profitable.
511486
if (!I->hasOneUse()) return false;

0 commit comments

Comments
 (0)