SCEVAddExpr::get() of an empty list is invalid.
authorChris Lattner <sabre@nondot.org>
Tue, 9 Aug 2005 01:13:47 +0000 (01:13 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 9 Aug 2005 01:13:47 +0000 (01:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22724 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index e20f4be998ebef9335800f09117b25e83abc9af1..1fcc45a3a4b0554cd2ad3293109e08100da755c1 100644 (file)
@@ -608,7 +608,10 @@ RemoveCommonExpressionsFromUseBases(std::vector<BasedUser> &Uses) {
       for (unsigned j = 0, e = AE->getNumOperands(); j != e; ++j)
         if (!SubExpressionUseCounts.count(AE->getOperand(j)))
           NewOps.push_back(AE->getOperand(j));
-      Uses[i].Base = SCEVAddExpr::get(NewOps);
+      if (NewOps.size() == 0)
+        Uses[i].Base = Zero;
+      else
+        Uses[i].Base = SCEVAddExpr::get(NewOps);
     } else {
       // If the base is zero (which is common), return zero now, there are no
       // CSEs we can find.