diff options
author | Dan Gohman <gohman@apple.com> | 2010-11-17 20:23:08 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-11-17 20:23:08 +0000 |
commit | 7c0fd8eb724a7228a6cf7e3e5487614c25202a91 (patch) | |
tree | 4bee2f4508f0afb520787bd42710bb1cb3968ba7 /include/llvm/Analysis/ScalarEvolution.h | |
parent | c4af4638dfdab0dc3b6257276cfad2ee45053060 (diff) | |
download | llvm-7c0fd8eb724a7228a6cf7e3e5487614c25202a91.tar.gz llvm-7c0fd8eb724a7228a6cf7e3e5487614c25202a91.tar.bz2 llvm-7c0fd8eb724a7228a6cf7e3e5487614c25202a91.tar.xz |
Fix ScalarEvolution's range memoization to avoid using a
default ctor with ConstantRange.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolution.h')
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index f004f6c3f8..8b18244049 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -273,6 +273,26 @@ namespace llvm { /// SignedRanges - Memoized results from getSignedRange DenseMap<const SCEV *, ConstantRange> SignedRanges; + /// setUnsignedRange - Set the memoized unsigned range for the given SCEV. + const ConstantRange &setUnsignedRange(const SCEV *S, + const ConstantRange &CR) { + std::pair<DenseMap<const SCEV *, ConstantRange>::iterator, bool> Pair = + UnsignedRanges.insert(std::make_pair(S, CR)); + if (!Pair.second) + Pair.first->second = CR; + return Pair.first->second; + } + + /// setUnsignedRange - Set the memoized signed range for the given SCEV. + const ConstantRange &setSignedRange(const SCEV *S, + const ConstantRange &CR) { + std::pair<DenseMap<const SCEV *, ConstantRange>::iterator, bool> Pair = + SignedRanges.insert(std::make_pair(S, CR)); + if (!Pair.second) + Pair.first->second = CR; + return Pair.first->second; + } + /// createSCEV - We know that there is no SCEV for the specified value. /// Analyze the expression. const SCEV *createSCEV(Value *V); |