Teach getSmallConstantTripMultiple about Shl operators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89426 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2009-11-20 01:09:34 +00:00
parent 9ef4835bd8
commit ac146657fc
2 changed files with 33 additions and 0 deletions

View File

@@ -243,6 +243,11 @@ unsigned Loop::getSmallConstantTripMultiple() const {
case BinaryOperator::Mul:
Result = dyn_cast<ConstantInt>(BO->getOperand(1));
break;
case BinaryOperator::Shl:
if (ConstantInt *CI = dyn_cast<ConstantInt>(BO->getOperand(1)))
if (CI->getValue().getActiveBits() <= 5)
return 1u << CI->getZExtValue();
break;
default:
break;
}