[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Reid Spencer reid at x10sys.com
Thu Mar 1 18:59:42 PST 2007



Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.103 -> 1.104
---
Log message:

Fix an unequal bitwidth issue.


---
Diffs of the changes:  (+6 -3)

 ScalarEvolution.cpp |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.103 llvm/lib/Analysis/ScalarEvolution.cpp:1.104
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.103	Thu Mar  1 18:28:51 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Thu Mar  1 20:59:25 2007
@@ -1341,9 +1341,12 @@
       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());
   






More information about the llvm-commits mailing list