summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit7a69e3aef388707e168f98551aacd89b71a2b89d (patch)
tree19b5f29e5b2e1693682c099995d70f0acb28a972 /llvm/lib/Transforms/Scalar/GVN.cpp
parentc21cfe37ec5e55dbd7d3214a086412e793041144 (diff)
downloadbcm5719-llvm-7a69e3aef388707e168f98551aacd89b71a2b89d.tar.gz
bcm5719-llvm-7a69e3aef388707e168f98551aacd89b71a2b89d.zip
Fix a bug in GVN that Duncan noticed, where we potentially need to insert a
pointer bitcast when performing return slot optimization. llvm-svn: 48343
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GVN.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 545f7091cc1..1d764af6888 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud