diff options
author | Owen Anderson <resistor@mac.com> | 2008-03-13 22:07:10 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-03-13 22:07:10 +0000 |
commit | 8a97fddbc2c064e295ad5fb6269795bd904e1ed2 (patch) | |
tree | 905cd8e0354587610a352135dad5972c6703193f /lib/Transforms | |
parent | 200d607b45e48f9660985b60ff7c5382f1677368 (diff) |
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')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 545f7091cc..1d764af688 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. |