[PATCH] D91649: [AA] Split up LocationSize::unknown()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 11:20:44 PST 2020


nikic created this revision.
nikic added reviewers: asbirlea, jdoerfert.
Herald added subscribers: llvm-commits, bmahjour, george.burgess.iv, hiraditya.
Herald added a project: LLVM.
nikic requested review of this revision.

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 non-negative sizes, i.e. accesses after the base pointer. Some parts (various callers of AA) assume that `LocationSize::unknown()` allows any kind of "based on" access, including accesses before the base pointer.

This patch splits up `LocationSize::unknown()` into `LocationSize::unknownNonNegative()` and `LocationSize::unknownMaybeNegative()` 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91649

Files:
  llvm/include/llvm/Analysis/AliasAnalysis.h
  llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
  llvm/include/llvm/Analysis/MemoryLocation.h
  llvm/include/llvm/Analysis/MemorySSA.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
  llvm/lib/Analysis/AliasSetTracker.cpp
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
  llvm/lib/Analysis/DependenceAnalysis.cpp
  llvm/lib/Analysis/Lint.cpp
  llvm/lib/Analysis/LoopAccessAnalysis.cpp
  llvm/lib/Analysis/MemoryLocation.cpp
  llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
  llvm/lib/CodeGen/ImplicitNullChecks.cpp
  llvm/lib/CodeGen/MachinePipeliner.cpp
  llvm/lib/Target/ARM/ARMParallelDSP.cpp
  llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/test/Analysis/AliasSet/argmemonly.ll
  llvm/test/Analysis/AliasSet/memset.ll
  llvm/test/Analysis/AliasSet/memtransfer.ll
  llvm/test/Analysis/BasicAA/cs-cs.ll
  llvm/unittests/Analysis/AliasAnalysisTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91649.305859.patch
Type: text/x-patch
Size: 38578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201117/574d1203/attachment-0001.bin>


More information about the llvm-commits mailing list