Revert "InstrProf: Don't keep a large sparse list around just to zero it"

This seems to be crashing on some buildbots. Reverting to investigate.

This reverts commit r218879.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218881 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner
2014-10-02 16:15:27 +00:00
parent 1476756523
commit a740e5d8d6
2 changed files with 32 additions and 45 deletions

View File

@ -103,6 +103,8 @@ struct CounterExpression {
class CounterExpressionBuilder {
/// \brief A list of all the counter expressions
llvm::SmallVector<CounterExpression, 16> Expressions;
/// \brief An array of terms used in expression simplification.
llvm::SmallVector<int, 16> Terms;
/// \brief Return the counter which corresponds to the given expression.
///
@ -111,19 +113,18 @@ class CounterExpressionBuilder {
/// expression is added to the builder's collection of expressions.
Counter get(const CounterExpression &E);
/// \brief Gather the terms of the expression tree for processing.
///
/// This collects each addition and subtraction referenced by the counter into
/// a sequence that can be sorted and combined to build a simplified counter
/// expression.
void extractTerms(Counter C, int Sign,
SmallVectorImpl<std::pair<unsigned, int>> &Terms);
/// \brief Convert the expression tree represented by a counter
/// into a polynomial in the form of K1Counter1 + .. + KNCounterN
/// where K1 .. KN are integer constants that are stored in the Terms array.
void extractTerms(Counter C, int Sign = 1);
/// \brief Simplifies the given expression tree
/// by getting rid of algebraically redundant operations.
Counter simplify(Counter ExpressionTree);
public:
CounterExpressionBuilder(unsigned NumCounterValues);
ArrayRef<CounterExpression> getExpressions() const { return Expressions; }
/// \brief Return a counter that represents the expression