aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/MemCpyOptimizer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-29 01:43:36 +0000
committerChris Lattner <sabre@nondot.org>2008-11-29 01:43:36 +0000
commitfd9b56dc27b3509f41c7a08763e9cc49b422838d (patch)
treedef18a4ae1596487c205831717d1b5fc98e2296d /lib/Transforms/Scalar/MemCpyOptimizer.cpp
parentb80647df60b8cbd377a0cfc1e2acf46a0507358f (diff)
downloadexternal_llvm-fd9b56dc27b3509f41c7a08763e9cc49b422838d.zip
external_llvm-fd9b56dc27b3509f41c7a08763e9cc49b422838d.tar.gz
external_llvm-fd9b56dc27b3509f41c7a08763e9cc49b422838d.tar.bz2
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
Diffstat (limited to 'lib/Transforms/Scalar/MemCpyOptimizer.cpp')
-rw-r--r--lib/Transforms/Scalar/MemCpyOptimizer.cpp14
1 files changed, 7 insertions, 7 deletions
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 @@ 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();