diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2020-11-17 20:11:09 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-11-26 18:39:55 +0100 |
| commit | 4df8efce80e373dd1e05bd4910c796a0c91383e7 (patch) | |
| tree | e0a4f36abcfcdfe8740130a4a55488648cd1800e /llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | |
| parent | 668da8c361fef5ada092534d4d20ea450831f6f6 (diff) | |
| download | llvm-4df8efce80e373dd1e05bd4910c796a0c91383e7.tar.gz llvm-4df8efce80e373dd1e05bd4910c796a0c91383e7.tar.bz2 llvm-4df8efce80e373dd1e05bd4910c796a0c91383e7.zip | |
[AA] Split up LocationSize::unknown()
Currently, we have some confusion in the codebase regarding the
meaning of LocationSize::unknown(): Some parts (including most of
BasicAA) assume that LocationSize::unknown() only allows accesses
after the base pointer. Some parts (various callers of AA) assume
that LocationSize::unknown() allows accesses both before and after
the base pointer (but within the underlying object).
This patch splits up LocationSize::unknown() into
LocationSize::afterPointer() and LocationSize::beforeOrAfterPointer()
to make this completely unambiguous. I tried my best to determine
which one is appropriate for all the existing uses.
The test changes in cs-cs.ll in particular illustrate a previously
clearly incorrect AA result: We were effectively assuming that
argmemonly functions were only allowed to access their arguments
after the passed pointer, but not before it. I'm pretty sure that
this was not intentional, and it's certainly not specified by
LangRef that way.
Differential Revision: https://reviews.llvm.org/D91649
Diffstat (limited to 'llvm/lib/Analysis/MemoryDependenceAnalysis.cpp')
| -rw-r--r-- | llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index ab0105906682..9f2629c00a7d 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -148,7 +148,7 @@ static ModRefInfo GetLocation(const Instruction *Inst, MemoryLocation &Loc, if (const CallInst *CI = isFreeCall(Inst, &TLI)) { // calls to free() deallocate the entire structure - Loc = MemoryLocation(CI->getArgOperand(0), LocationSize::unknown()); + Loc = MemoryLocation::getAfter(CI->getArgOperand(0)); return ModRefInfo::Mod; } @@ -455,7 +455,7 @@ MemDepResult MemoryDependenceResults::getSimplePointerDependencyFrom( // pointer, not on query pointers that are indexed off of them. It'd // be nice to handle that at some point (the right approach is to use // GetPointerBaseWithConstantOffset). - MemoryLocation ArgLoc(II->getArgOperand(1), LocationSize::unknown()); + MemoryLocation ArgLoc = MemoryLocation::getAfter(II->getArgOperand(1)); if (BatchAA.isMustAlias(ArgLoc, MemLoc)) return MemDepResult::getDef(II); continue; |
