Reimplement the internal abstraction used by MemDep in terms

of a pointer/int pair instead of a manually bitmangled pointer.
This forces clients to think a little more about checking the 
appropriate pieces and will be useful for internal 
implementation improvements later.

I'm not particularly happy with this.  After going through this
I don't think that the clients of memdep should be exposed to
the internal type at all.  I'll fix this in a subsequent commit.

This has no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60230 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2008-11-29 01:43:36 +00:00
parent d63e618212
commit 39f372e23e
5 changed files with 207 additions and 190 deletions

View File

@ -629,18 +629,18 @@ bool MemCpyOpt::processMemCpy(MemCpyInst* M) {
// The are two possible optimizations we can do for memcpy:
// a) memcpy-memcpy xform which exposes redundance for DSE
// b) call-memcpy xform for return slot optimization
Instruction* dep = MD.getDependency(M);
if (dep == MemoryDependenceAnalysis::None ||
dep == MemoryDependenceAnalysis::NonLocal)
MemoryDependenceAnalysis::DepResultTy dep = MD.getDependency(M);
if (dep.getInt() == MemoryDependenceAnalysis::None ||
dep.getInt() == MemoryDependenceAnalysis::NonLocal)
return false;
else if (!isa<MemCpyInst>(dep)) {
if (CallInst* C = dyn_cast<CallInst>(dep))
else if (!isa<MemCpyInst>(dep.getPointer())) {
if (CallInst* C = dyn_cast<CallInst>(dep.getPointer()))
return performCallSlotOptzn(M, C);
else
return false;
}
MemCpyInst* MDep = cast<MemCpyInst>(dep);
MemCpyInst* MDep = cast<MemCpyInst>(dep.getPointer());
// We can only transforms memcpy's where the dest of one is the source of the
// other
@ -691,7 +691,7 @@ bool MemCpyOpt::processMemCpy(MemCpyInst* M) {
// If C and M don't interfere, then this is a valid transformation. If they
// did, this would mean that the two sources overlap, which would be bad.
if (MD.getDependency(C) == MDep) {
if (MD.getDependency(C) == dep) {
MD.dropInstruction(M);
M->eraseFromParent();