Fix an unequal bitwidth issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34831 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2007-03-02 02:59:25 +00:00
parent d2dceea3f3
commit 9b4aeb3cc1

View File

@ -1341,9 +1341,12 @@ static APInt GetConstantFactor(SCEVHandle S) {
return APInt(C->getBitWidth(), 1).shl(C->getBitWidth()-1);
}
if (SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(S))
return GetConstantFactor(T->getOperand()) &
cast<IntegerType>(T->getType())->getMask();
if (SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(S)) {
APInt Mask(cast<IntegerType>(T->getType())->getMask());
APInt GCF(GetConstantFactor(T->getOperand()));
Mask.zextOrTrunc(GCF.getBitWidth());
return GCF & Mask;
}
if (SCEVZeroExtendExpr *E = dyn_cast<SCEVZeroExtendExpr>(S))
return GetConstantFactor(E->getOperand());