[llvm-commits] [llvm] r131088 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp

Eli Friedman eli.friedman at gmail.com
Mon May 9 11:52:42 PDT 2011


On Mon, May 9, 2011 at 11:44 AM, Dan Gohman <gohman at apple.com> wrote:
> Author: djg
> Date: Mon May  9 13:44:09 2011
> New Revision: 131088
>
> URL: http://llvm.org/viewvc/llvm-project?rev=131088&view=rev
> Log:
> Change a few std::maps to DenseMaps.
>
> Modified:
>    llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
>    llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>
> Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=131088&r1=131087&r2=131088&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
> +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Mon May  9 13:44:09 2011
> @@ -270,30 +270,30 @@
>
>     /// BackedgeTakenCounts - Cache the backedge-taken count of the loops for
>     /// this function as they are computed.
> -    std::map<const Loop*, BackedgeTakenInfo> BackedgeTakenCounts;
> +    DenseMap<const Loop*, BackedgeTakenInfo> BackedgeTakenCounts;
>
>     /// ConstantEvolutionLoopExitValue - This map contains entries for all of
>     /// the PHI instructions that we attempt to compute constant evolutions for.
>     /// This allows us to avoid potentially expensive recomputation of these
>     /// properties.  An instruction maps to null if we are unable to compute its
>     /// exit value.
> -    std::map<PHINode*, Constant*> ConstantEvolutionLoopExitValue;
> +    DenseMap<PHINode*, Constant*> ConstantEvolutionLoopExitValue;
>
>     /// ValuesAtScopes - This map contains entries for all the expressions
>     /// that we attempt to compute getSCEVAtScope information for, which can
>     /// be expensive in extreme cases.
> -    std::map<const SCEV *,
> +    DenseMap<const SCEV *,
>              std::map<const Loop *, const SCEV *> > ValuesAtScopes;
>
>     /// LoopDispositions - Memoized computeLoopDisposition results.
> -    std::map<const SCEV *,
> +    DenseMap<const SCEV *,
>              std::map<const Loop *, LoopDisposition> > LoopDispositions;
>
>     /// computeLoopDisposition - Compute a LoopDisposition value.
>     LoopDisposition computeLoopDisposition(const SCEV *S, const Loop *L);
>
>     /// BlockDispositions - Memoized computeBlockDisposition results.
> -    std::map<const SCEV *,
> +    DenseMap<const SCEV *,
>              std::map<const BasicBlock *, BlockDisposition> > BlockDispositions;

Somehow a DenseMap of std::map doesn't strike me as good for
performance; copying an std::map isn't cheap.

-Eli




More information about the llvm-commits mailing list