Add a m_SignBit pattern for convenience.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124656 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2011-02-01 08:50:33 +00:00
parent 7681c6da60
commit 93c780288d
2 changed files with 16 additions and 3 deletions

View File

@@ -666,9 +666,7 @@ bool llvm::isPowerOfTwo(Value *V, const TargetData *TD, unsigned Depth) {
// (signbit) >>l X is clearly a power of two if the one is not shifted off the
// bottom. If it is shifted off the bottom then the result is undefined.
ConstantInt *CI;
if (match(V, m_LShr(m_ConstantInt(CI), m_Value())) &&
CI->getValue().isSignBit())
if (match(V, m_LShr(m_SignBit(), m_Value())))
return true;
// The remaining tests are all recursive, so bail out if we hit the limit.