diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 02:59:25 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 02:59:25 +0000 |
commit | 9b4aeb3cc13d875ccfce1b81f21aaf93d6471e47 (patch) | |
tree | c5771696e32af4cd470221ec05d6ddaa4d467695 /lib/Analysis/ScalarEvolution.cpp | |
parent | d2dceea3f3cefd03e56850801fcc5fa4e589c95d (diff) |
Fix an unequal bitwidth issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 438e42886b..d2eca4adeb 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -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()); |