[llvm-commits] [llvm] r51636 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/memmove.ll
Chris Lattner
sabre at nondot.org
Tue May 27 22:30:42 PDT 2008
Author: lattner
Date: Wed May 28 00:30:41 2008
New Revision: 51636
URL: http://llvm.org/viewvc/llvm-project?rev=51636&view=rev
Log:
Implement PR2370: memmove(x,x,size) -> noop.
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/test/Transforms/InstCombine/memmove.ll
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=51636&r1=51635&r2=51636&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed May 28 00:30:41 2008
@@ -9131,6 +9131,10 @@
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
Modified: llvm/trunk/test/Transforms/InstCombine/memmove.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memmove.ll?rev=51636&r1=51635&r2=51636&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/memmove.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/memmove.ll Wed May 28 00:30:41 2008
@@ -34,3 +34,9 @@
ret i32 0
}
+; PR2370
+define void @test4(i8* %a) {
+ tail call void @llvm.memmove.i32( i8* %a, i8* %a, i32 100, i32 1 )
+ ret void
+}
+
More information about the llvm-commits
mailing list