diff options
author | Chris Lattner <sabre@nondot.org> | 2008-05-28 05:30:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-05-28 05:30:41 +0000 |
commit | a935db8ea28ee73be647e8aa46ce59baf9279306 (patch) | |
tree | 972f570b46f92773f937cbd48c623bf3bcd70108 /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | e5ab3355ba30d6d45ce67482039ee567f3763284 (diff) |
Implement PR2370: memmove(x,x,size) -> noop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 20204154d0..8c2dc3e92f 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -9131,6 +9131,10 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { CI.setOperand(0, Intrinsic::getDeclaration(M, MemCpyID)); Changed = true; } + + // memmove(x,x,size) -> noop. + if (MMI->getSource() == MMI->getDest()) + return EraseInstFromFunction(CI); } // If we can determine a pointer alignment that is bigger than currently |