mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 06:25:18 +00:00
[PM/AA] Start refactoring AliasAnalysis to remove the analysis group and
port it to the new pass manager. All this does is extract the inner "location" class used by AA into its own full fledged type. This seems *much* cleaner as MemoryDependence and soon MemorySSA also use this heavily, and it doesn't make much sense being inside the AA infrastructure. This will also make it much easier to break apart the AA infrastructure into something that stands on its own rather than using the analysis group design. There are a few places where this makes APIs not make sense -- they were taking an AliasAnalysis pointer just to build locations. I'll try to clean those up in follow-up commits. Differential Revision: http://reviews.llvm.org/D10228 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -510,7 +510,7 @@ bool MemCpyOpt::processStore(StoreInst *SI, BasicBlock::iterator &BBI) {
|
||||
// Check that nothing touches the dest of the "copy" between
|
||||
// the call and the store.
|
||||
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
|
||||
AliasAnalysis::Location StoreLoc = AA.getLocation(SI);
|
||||
AliasAnalysis::Location StoreLoc = MemoryLocation::get(SI);
|
||||
for (BasicBlock::iterator I = --BasicBlock::iterator(SI),
|
||||
E = C; I != E; --I) {
|
||||
if (AA.getModRefInfo(&*I, StoreLoc) != AliasAnalysis::NoModRef) {
|
||||
@@ -802,9 +802,8 @@ bool MemCpyOpt::processMemCpyMemCpyDependence(MemCpyInst *M, MemCpyInst *MDep) {
|
||||
//
|
||||
// NOTE: This is conservative, it will stop on any read from the source loc,
|
||||
// not just the defining memcpy.
|
||||
MemDepResult SourceDep =
|
||||
MD->getPointerDependencyFrom(AA.getLocationForSource(MDep),
|
||||
false, M, M->getParent());
|
||||
MemDepResult SourceDep = MD->getPointerDependencyFrom(
|
||||
MemoryLocation::getForSource(MDep), false, M, M->getParent());
|
||||
if (!SourceDep.isClobber() || SourceDep.getInst() != MDep)
|
||||
return false;
|
||||
|
||||
@@ -812,7 +811,8 @@ bool MemCpyOpt::processMemCpyMemCpyDependence(MemCpyInst *M, MemCpyInst *MDep) {
|
||||
// source and dest might overlap. We still want to eliminate the intermediate
|
||||
// value, but we have to generate a memmove instead of memcpy.
|
||||
bool UseMemMove = false;
|
||||
if (!AA.isNoAlias(AA.getLocationForDest(M), AA.getLocationForSource(MDep)))
|
||||
if (!AA.isNoAlias(MemoryLocation::getForDest(M),
|
||||
MemoryLocation::getForSource(MDep)))
|
||||
UseMemMove = true;
|
||||
|
||||
// If all checks passed, then we can transform M.
|
||||
@@ -860,9 +860,8 @@ bool MemCpyOpt::processMemSetMemCpyDependence(MemCpyInst *MemCpy,
|
||||
return false;
|
||||
|
||||
// Check that there are no other dependencies on the memset destination.
|
||||
MemDepResult DstDepInfo =
|
||||
MD->getPointerDependencyFrom(AliasAnalysis::getLocationForDest(MemSet),
|
||||
false, MemCpy, MemCpy->getParent());
|
||||
MemDepResult DstDepInfo = MD->getPointerDependencyFrom(
|
||||
MemoryLocation::getForDest(MemSet), false, MemCpy, MemCpy->getParent());
|
||||
if (DstDepInfo.getInst() != MemSet)
|
||||
return false;
|
||||
|
||||
@@ -998,7 +997,7 @@ bool MemCpyOpt::processMemCpy(MemCpyInst *M) {
|
||||
}
|
||||
}
|
||||
|
||||
AliasAnalysis::Location SrcLoc = AliasAnalysis::getLocationForSource(M);
|
||||
AliasAnalysis::Location SrcLoc = MemoryLocation::getForSource(M);
|
||||
MemDepResult SrcDepInfo = MD->getPointerDependencyFrom(SrcLoc, true,
|
||||
M, M->getParent());
|
||||
|
||||
@@ -1047,7 +1046,8 @@ bool MemCpyOpt::processMemMove(MemMoveInst *M) {
|
||||
return false;
|
||||
|
||||
// See if the pointers alias.
|
||||
if (!AA.isNoAlias(AA.getLocationForDest(M), AA.getLocationForSource(M)))
|
||||
if (!AA.isNoAlias(MemoryLocation::getForDest(M),
|
||||
MemoryLocation::getForSource(M)))
|
||||
return false;
|
||||
|
||||
DEBUG(dbgs() << "MemCpyOpt: Optimizing memmove -> memcpy: " << *M << "\n");
|
||||
@@ -1121,8 +1121,8 @@ bool MemCpyOpt::processByValArgument(CallSite CS, unsigned ArgNo) {
|
||||
// NOTE: This is conservative, it will stop on any read from the source loc,
|
||||
// not just the defining memcpy.
|
||||
MemDepResult SourceDep =
|
||||
MD->getPointerDependencyFrom(AliasAnalysis::getLocationForSource(MDep),
|
||||
false, CS.getInstruction(), MDep->getParent());
|
||||
MD->getPointerDependencyFrom(MemoryLocation::getForSource(MDep), false,
|
||||
CS.getInstruction(), MDep->getParent());
|
||||
if (!SourceDep.isClobber() || SourceDep.getInst() != MDep)
|
||||
return false;
|
||||
|
||||
|
Reference in New Issue
Block a user