From 4ce61144cb49b48817f0215820173005c8d7d816 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 5 Oct 2020 17:51:13 +0100 Subject: [PATCH] [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. --- .../Transforms/InstCombine/InstCombineShifts.cpp | 25 ---------------------- 1 file changed, 25 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index 983b45c..6a4ecd2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -481,31 +481,6 @@ static bool canEvaluateShifted(Value *V, unsigned NumBits, bool IsLeftShift, Instruction *I = dyn_cast(V); if (!I) return false; - // If this is the opposite shift, we can directly reuse the input of the shift - // if the needed bits are already zero in the input. This allows us to reuse - // the value which means that we don't care if the shift has multiple uses. - // TODO: Handle opposite shift by exact value. - ConstantInt *CI = nullptr; - if ((IsLeftShift && match(I, m_LShr(m_Value(), m_ConstantInt(CI)))) || - (!IsLeftShift && match(I, m_Shl(m_Value(), m_ConstantInt(CI))))) { - if (CI->getValue() == NumBits) { - // TODO: Check that the input bits are already zero with MaskedValueIsZero -#if 0 - // If this is a truncate of a logical shr, we can truncate it to a smaller - // lshr iff we know that the bits we would otherwise be shifting in are - // already zeros. - uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits(); - uint32_t BitWidth = Ty->getScalarSizeInBits(); - if (MaskedValueIsZero(I->getOperand(0), - APInt::getHighBitsSet(OrigBitWidth, OrigBitWidth-BitWidth)) && - CI->getLimitedValue(BitWidth) < BitWidth) { - return CanEvaluateTruncated(I->getOperand(0), Ty); - } -#endif - - } - } - // We can't mutate something that has multiple uses: doing so would // require duplicating the instruction in general, which isn't profitable. if (!I->hasOneUse()) return false; -- 2.7.4