summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-12-17 21:07:31 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-12-17 21:07:31 +0000
commit5842c9968a861f23f67ea472a50d409e97824390 (patch)
tree78fa9823f3d4c1018e8a89a8c67b47b8f36feb45 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parent5908f1e27b6cd3c132d1e797889e3c8a279324ed (diff)
downloadbcm5719-llvm-5842c9968a861f23f67ea472a50d409e97824390.tar.gz
bcm5719-llvm-5842c9968a861f23f67ea472a50d409e97824390.zip
Slightly generalize transformation of memmove(a,a,n) so that it also applies
to memcpy. (Such a memcpy is technically illegal, but in practice is safe and is generated by struct self-assignment in C code.) llvm-svn: 91621
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index b9c536fe1e5..c7359c4de76 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -9896,9 +9896,11 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
Intrinsic::getDeclaration(M, MemCpyID, Tys, 1));
Changed = true;
}
+ }
+ if (MemTransferInst *MTI = dyn_cast<MemTransferInst>(MI)) {
// memmove(x,x,size) -> noop.
- if (MMI->getSource() == MMI->getDest())
+ if (MTI->getSource() == MTI->getDest())
return EraseInstFromFunction(CI);
}
OpenPOWER on IntegriCloud