This patch prevents an infinite recursion while compiling 103.su2cor.
authorChris Lattner <sabre@nondot.org>
Sat, 4 Dec 2004 20:54:32 +0000 (20:54 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 4 Dec 2004 20:54:32 +0000 (20:54 +0000)
All SPEC CFP 95 programs now work, though the JIT isn't loading -lf2c right
so they aren't testing correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18499 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index f84c9e98593a9ed34900d1a45c2c17c3612c12ed..757211639bf2bb3ece16a0f568903e2da9c01f15 100644 (file)
@@ -635,8 +635,7 @@ SCEVHandle SCEVAddExpr::get(std::vector<SCEVHandle> &Ops) {
     for (unsigned MulOp = 0, e = Mul->getNumOperands(); MulOp != e; ++MulOp) {
       SCEV *MulOpSCEV = Mul->getOperand(MulOp);
       for (unsigned AddOp = 0, e = Ops.size(); AddOp != e; ++AddOp)
-        if (MulOpSCEV == Ops[AddOp] &&
-            (Mul->getNumOperands() != 2 || !isa<SCEVConstant>(MulOpSCEV))) {
+        if (MulOpSCEV == Ops[AddOp] && !isa<SCEVConstant>(MulOpSCEV)) {
           // Fold W + X + (X * Y * Z)  -->  W + (X * ((Y*Z)+1))
           SCEVHandle InnerMul = Mul->getOperand(MulOp == 0);
           if (Mul->getNumOperands() != 2) {
@@ -937,7 +936,8 @@ SCEVHandle SCEVMulExpr::get(std::vector<SCEVHandle> &Ops) {
   std::vector<SCEV*> SCEVOps(Ops.begin(), Ops.end());
   SCEVCommutativeExpr *&Result = SCEVCommExprs[std::make_pair(scMulExpr,
                                                               SCEVOps)];
-  if (Result == 0) Result = new SCEVMulExpr(Ops);
+  if (Result == 0)
+    Result = new SCEVMulExpr(Ops);
   return Result;
 }