OSDN Git Service

Make LocationSize a proper Optional type; NFC
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Tue, 9 Oct 2018 03:18:56 +0000 (03:18 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Tue, 9 Oct 2018 03:18:56 +0000 (03:18 +0000)
commitdef2c06ca285c9871605f852f4e96a4bbe105217
tree2f9020c0bd1dee73811a4da0d5aeadc8f31d2d05
parent5454da3a19a2aefc5f2f6a662570f347f399a1ec
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().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344013 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/MemoryLocation.h
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/CFLAndersAliasAnalysis.cpp
lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
lib/Transforms/Scalar/DeadStoreElimination.cpp