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
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index 6d27327..acc6630 100644
--- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -629,18 +629,18 @@
// 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 @@
// 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();