diff options
author | Owen Anderson <resistor@mac.com> | 2008-04-29 21:51:00 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-04-29 21:51:00 +0000 |
commit | 02e9988020acb3e8b0271aa9ebc7c8e770c8a85f (patch) | |
tree | 6f3a19fc151f647c07e1b72f9f896bf26c990da0 /lib/Transforms/Scalar/MemCpyOptimizer.cpp | |
parent | 9dcace3cafb4da5c3d94f3b89e54ea0d7164a286 (diff) | |
download | external_llvm-02e9988020acb3e8b0271aa9ebc7c8e770c8a85f.zip external_llvm-02e9988020acb3e8b0271aa9ebc7c8e770c8a85f.tar.gz external_llvm-02e9988020acb3e8b0271aa9ebc7c8e770c8a85f.tar.bz2 |
Revert r50441. The original code was correct. Add some more comments so that I don't make the same mistake in the future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50446 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/MemCpyOptimizer.cpp')
-rw-r--r-- | lib/Transforms/Scalar/MemCpyOptimizer.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 9a39c8f..d6e5f39 100644 --- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -668,18 +668,24 @@ bool MemCpyOpt::processMemCpy(MemCpyInst* M) { CallInst* C = CallInst::Create(MemCpyFun, args.begin(), args.end(), "", 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) { MD.dropInstruction(M); M->eraseFromParent(); + + NumMemCpyInstr++; + return true; } + // Otherwise, there was no point in doing this, so we remove the call we + // inserted and act like nothing happened. MD.removeInstruction(C); C->eraseFromParent(); - NumMemCpyInstr++; - - return true; + return false; } // MemCpyOpt::runOnFunction - This is the main transformation entry point for a |