summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2018-10-09 03:18:56 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2018-10-09 03:18:56 +0000
commitf96e618017c3ca74934a7e8ef941e346c31e5092 (patch)
treeba7f2f9e89bb75256b5cd5fde4e1c077dc46e472 /llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
parentfefc42c9bbf44e755f213f494f263a52cbe12913 (diff)
downloadbcm5719-llvm-f96e618017c3ca74934a7e8ef941e346c31e5092.tar.gz
bcm5719-llvm-f96e618017c3ca74934a7e8ef941e346c31e5092.zip
Make LocationSize a proper Optional type; NFC
This is the second in a series of changes intended to make https://reviews.llvm.org/D44748 more easily reviewable. Please see that patch for more context. The first change being r344012. Since I was requested to do all of this with post-commit review, this is about as small as I can make this patch. This patch makes LocationSize into an actual type that wraps a uint64_t; users are required to call getValue() in order to get the size now. If the LocationSize has an Unknown size (e.g. if LocSize == MemoryLocation::UnknownSize), getValue() will assert. This also adds DenseMap specializations for LocationInfo, which required taking two more values from the set of values LocationInfo can represent. Hence, heavy users of multi-exabyte arrays or structs may observe slightly lower-quality code as a result of this change. The intent is for getValue()s to be very close to a corresponding hasValue() (which is often spelled `!= MemoryLocation::UnknownSize`). Sadly, small diff context appears to crop that out sometimes, and the last change in DSE does require a bit of nonlocal reasoning about control-flow. :/ This also removes an assert, since it's now redundant with the assert in getValue(). llvm-svn: 344013
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp b/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
index 7bea994121c..61f625477ca 100644
--- a/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
@@ -43,8 +43,12 @@ AliasResult SCEVAAResult::alias(const MemoryLocation &LocA,
if (SE.getEffectiveSCEVType(AS->getType()) ==
SE.getEffectiveSCEVType(BS->getType())) {
unsigned BitWidth = SE.getTypeSizeInBits(AS->getType());
- APInt ASizeInt(BitWidth, LocA.Size);
- APInt BSizeInt(BitWidth, LocB.Size);
+ APInt ASizeInt(BitWidth, LocA.Size.hasValue()
+ ? LocA.Size.getValue()
+ : MemoryLocation::UnknownSize);
+ APInt BSizeInt(BitWidth, LocB.Size.hasValue()
+ ? LocB.Size.getValue()
+ : MemoryLocation::UnknownSize);
// Compute the difference between the two pointers.
const SCEV *BA = SE.getMinusSCEV(BS, AS);
OpenPOWER on IntegriCloud