From 02742710f36763ed6210f03012efc8262c177115 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 9 Aug 2005 01:13:47 +0000 Subject: [PATCH] SCEVAddExpr::get() of an empty list is invalid. llvm-svn: 22724 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index e20f4be998eb..1fcc45a3a4b0 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -608,7 +608,10 @@ RemoveCommonExpressionsFromUseBases(std::vector &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. -- GitLab