aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/GVN.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-03-13 22:07:10 +0000
committerOwen Anderson <resistor@mac.com>2008-03-13 22:07:10 +0000
commit78a334f549e9f671d5abcaf0bae5ba5311a31f92 (patch)
tree905cd8e0354587610a352135dad5972c6703193f /lib/Transforms/Scalar/GVN.cpp
parented5fb3b5badcc0274c2ed561765b5327db2fda01 (diff)
downloadexternal_llvm-78a334f549e9f671d5abcaf0bae5ba5311a31f92.zip
external_llvm-78a334f549e9f671d5abcaf0bae5ba5311a31f92.tar.gz
external_llvm-78a334f549e9f671d5abcaf0bae5ba5311a31f92.tar.bz2
Fix a bug in GVN that Duncan noticed, where we potentially need to insert a
pointer bitcast when performing return slot optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/GVN.cpp')
-rw-r--r--lib/Transforms/Scalar/GVN.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 545f709..1d764af 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -1171,8 +1171,12 @@ bool GVN::performCallSlotOptzn(MemCpyInst* cpy, CallInst* C,
// All the checks have passed, so do the transformation.
for (unsigned i = 0; i < CS.arg_size(); ++i)
- if (CS.getArgument(i) == cpySrc)
+ if (CS.getArgument(i) == cpySrc) {
+ if (cpySrc->getType() != cpyDest->getType())
+ cpyDest = CastInst::createPointerCast(cpyDest, cpySrc->getType(),
+ cpyDest->getName(), C);
CS.setArgument(i, cpyDest);
+ }
// Drop any cached information about the call, because we may have changed
// its dependence information by changing its parameter.