diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-29 02:29:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-29 02:29:27 +0000 |
commit | 4c724006256032e827177afeae04ea62436796e7 (patch) | |
tree | bb98da8198cb36f5b0c55535ee30ded58a906848 /lib/Transforms/Scalar/MemCpyOptimizer.cpp | |
parent | 39f372e23e49cecb8db2eb7120eb331173e50c74 (diff) | |
download | external_llvm-4c724006256032e827177afeae04ea62436796e7.zip external_llvm-4c724006256032e827177afeae04ea62436796e7.tar.gz external_llvm-4c724006256032e827177afeae04ea62436796e7.tar.bz2 |
Introduce and use a new MemDepResult class to hold the results of a memdep
query. This makes it crystal clear what cases can escape from MemDep that
the clients have to handle. This also gives the clients a nice simplified
interface to it that is easy to poke at.
This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType
private, yay.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/MemCpyOptimizer.cpp')
-rw-r--r-- | lib/Transforms/Scalar/MemCpyOptimizer.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp index acc6630..40eaa1d 100644 --- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -629,18 +629,17 @@ 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 - MemoryDependenceAnalysis::DepResultTy dep = MD.getDependency(M); - if (dep.getInt() == MemoryDependenceAnalysis::None || - dep.getInt() == MemoryDependenceAnalysis::NonLocal) + MemDepResult dep = MD.getDependency(M); + if (!dep.isNormal()) return false; - else if (!isa<MemCpyInst>(dep.getPointer())) { - if (CallInst* C = dyn_cast<CallInst>(dep.getPointer())) + else if (!isa<MemCpyInst>(dep.getInst())) { + if (CallInst* C = dyn_cast<CallInst>(dep.getInst())) return performCallSlotOptzn(M, C); else return false; } - MemCpyInst* MDep = cast<MemCpyInst>(dep.getPointer()); + MemCpyInst* MDep = cast<MemCpyInst>(dep.getInst()); // We can only transforms memcpy's where the dest of one is the source of the // other |