summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-02 02:59:25 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-02 02:59:25 +0000
commite1336b4086c523dd7f4c538b0bc582c45bc3f65f (patch)
tree3ee2ed87c5fbf376048a8ba50de1a9573d40ca0f /llvm/lib/Analysis
parent73f28259571721ca90be0d067b3303e6e4405e12 (diff)
downloadbcm5719-llvm-e1336b4086c523dd7f4c538b0bc582c45bc3f65f.tar.gz
bcm5719-llvm-e1336b4086c523dd7f4c538b0bc582c45bc3f65f.zip
Fix an unequal bitwidth issue.
llvm-svn: 34831
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 438e42886bf..d2eca4adeb4 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/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());
OpenPOWER on IntegriCloud