Changes in directory llvm/lib/Analysis:
ScalarEvolution.cpp updated: 1.104 -> 1.105 --- Log message: Guard further against APInt operations with operands of unequal bit width. --- Diffs of the changes: (+11 -4) ScalarEvolution.cpp | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.104 llvm/lib/Analysis/ScalarEvolution.cpp:1.105 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.104 Thu Mar 1 20:59:25 2007 +++ llvm/lib/Analysis/ScalarEvolution.cpp Sat Mar 3 19:25:35 2007 @@ -1354,16 +1354,22 @@ // The result is the min of all operands. APInt Res = GetConstantFactor(A->getOperand(0)); for (unsigned i = 1, e = A->getNumOperands(); - i != e && Res.ugt(APInt(Res.getBitWidth(),1)); ++i) - Res = APIntOps::umin(Res, GetConstantFactor(A->getOperand(i))); + i != e && Res.ugt(APInt(Res.getBitWidth(),1)); ++i) { + APInt Tmp(GetConstantFactor(A->getOperand(i))); + Tmp.zextOrTrunc(Res.getBitWidth()); + Res = APIntOps::umin(Res, Tmp); + } return Res; } if (SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(S)) { // The result is the product of all the operands. APInt Res = GetConstantFactor(M->getOperand(0)); - for (unsigned i = 1, e = M->getNumOperands(); i != e; ++i) - Res *= GetConstantFactor(M->getOperand(i)); + for (unsigned i = 1, e = M->getNumOperands(); i != e; ++i) { + APInt Tmp(GetConstantFactor(M->getOperand(i))); + Tmp.zextOrTrunc(Res.getBitWidth()); + Res *= Tmp; + } return Res; } @@ -1375,6 +1381,7 @@ if (Start == 1) return APInt(A->getBitWidth(),1); APInt Stride = GetConstantFactor(A->getOperand(1)); + Start.zextOrTrunc(Stride.getBitWidth()); return APIntOps::GreatestCommonDivisor(Start, Stride); } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits