aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2021-03-19 11:15:29 -0700
committerPhilip Reames <listmail@philipreames.com>2021-03-19 11:17:19 -0700
commit5698537f81a2ecf1166f41cab264b92af670aaa1 (patch)
treeddf63abda7567ddc830bb59d2db784edd83d2f4e /llvm/lib/Analysis/BasicAliasAnalysis.cpp
parent66f340051ac2d334f30ef85251323b12cb2e6e5f (diff)
downloadllvm-5698537f81a2ecf1166f41cab264b92af670aaa1.zip
llvm-5698537f81a2ecf1166f41cab264b92af670aaa1.tar.gz
llvm-5698537f81a2ecf1166f41cab264b92af670aaa1.tar.bz2
Update basic deref API to account for possiblity of free [NFC]
This patch is plumbing to support work towards the goal outlined in the recent llvm-dev post "[llvm-dev] RFC: Decomposing deref(N) into deref(N) + nofree". The point of this change is purely to simplify iteration on other pieces on way to making the switch. Rebuilding with a change to Value.h is slow and painful, so I want to get the API change landed. Once that's done, I plan to more closely audit each caller, add the inference rules in their own patch, then post a patch with the langref changes and test diffs. The value of the command line flag is that we can exercise the inference logic in standalone patches without needing the whole switch ready to go just yet. Differential Revision: https://reviews.llvm.org/D98908
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 11fa4d2893..a8c5b9c 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -199,9 +199,11 @@ static uint64_t getMinimalExtentFrom(const Value &V,
// If we have dereferenceability information we know a lower bound for the
// extent as accesses for a lower offset would be valid. We need to exclude
// the "or null" part if null is a valid pointer.
- bool CanBeNull;
- uint64_t DerefBytes = V.getPointerDereferenceableBytes(DL, CanBeNull);
+ bool CanBeNull, CanBeFreed;
+ uint64_t DerefBytes =
+ V.getPointerDereferenceableBytes(DL, CanBeNull, CanBeFreed);
DerefBytes = (CanBeNull && NullIsValidLoc) ? 0 : DerefBytes;
+ DerefBytes = CanBeFreed ? 0 : DerefBytes;
// If queried with a precise location size, we assume that location size to be
// accessed, thus valid.
if (LocSize.isPrecise())