From fd9b56dc27b3509f41c7a08763e9cc49b422838d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 29 Nov 2008 01:43:36 +0000 Subject: 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 --- lib/Transforms/Scalar/MemCpyOptimizer.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/Transforms/Scalar/MemCpyOptimizer.cpp') 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(dep)) { - if (CallInst* C = dyn_cast(dep)) + else if (!isa(dep.getPointer())) { + if (CallInst* C = dyn_cast(dep.getPointer())) return performCallSlotOptzn(M, C); else return false; } - MemCpyInst* MDep = cast(dep); + MemCpyInst* MDep = cast(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(); -- cgit v1.1