[PATCH] D35441: Allow None as a MemoryLocation to getModRefInfo

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 15:20:18 PDT 2017


asbirlea created this revision.
Herald added a subscriber: sanjoy.

Adding part of the changes in https://reviews.llvm.org/D30369 (needed to make progress):
Current patch updates AliasAnalysis and MemoryLocation, but does _not_ clean up MemorySSA.

Original summary from https://reviews.llvm.org/D30369, by dberlin:
Currently, we have instructions which affect memory but have no memory
location. If you call, for example, MemoryLocation::get on a fence,
it asserts. This means things specifically have to avoid that. It
also means we end up with a copy of each API, one taking a memory
location, one not.

This starts to fix that.

We add MemoryLocation::getOrNone as a new call, and reimplement the
old asserting version in terms of it.

We make MemoryLocation optional in the (Instruction, MemoryLocation)
version of getModRefInfo, and kill the old one argument version in
favor of passing None (it had one caller). Now both can handle fences
because you can just use MemoryLocation::getOrNone on an instruction
and it will return a correct answer.

We use all this to clean up part of MemorySSA that had to handle this difference.

Note that literally every actual getModRefInfo interface we have could be made private and replaced with:

getModRefInfo(Instruction, Optional<MemoryLocation>)
and
getModRefInfo(Instruction, Optional<MemoryLocation>, Instruction, Optional<MemoryLocation>)

and delegating to the right ones, if we wanted to.

I have not attempted to do this yet.


https://reviews.llvm.org/D35441

Files:
  include/llvm/Analysis/AliasAnalysis.h
  include/llvm/Analysis/MemoryLocation.h
  lib/Analysis/MemorySSA.cpp
  lib/Transforms/Scalar/MemCpyOptimizer.cpp
  unittests/Analysis/AliasAnalysisTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35441.106719.patch
Type: text/x-patch
Size: 7378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170714/61435e27/attachment.bin>


More information about the llvm-commits mailing list