summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-12-07 02:58:45 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-12-07 02:58:45 +0000
commiteb2934e78230f0a03db4b35b33ba9eda77755967 (patch)
tree734988ed191b9409309cff2eb4d77781bd75c0ed /lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
parent47172e86cc0f5cf59bd450bc80fb304a2d128aab (diff)
downloadllvm-eb2934e78230f0a03db4b35b33ba9eda77755967.tar.gz
llvm-eb2934e78230f0a03db4b35b33ba9eda77755967.tar.bz2
llvm-eb2934e78230f0a03db4b35b33ba9eda77755967.tar.xz
Fix assert with copy from global through addrspacecast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 0a0727e0fa..4c861b3fd0 100644
--- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -263,9 +263,9 @@ Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {
for (unsigned i = 0, e = ToDelete.size(); i != e; ++i)
EraseInstFromFunction(*ToDelete[i]);
Constant *TheSrc = cast<Constant>(Copy->getSource());
- Instruction *NewI
- = ReplaceInstUsesWith(AI, ConstantExpr::getBitCast(TheSrc,
- AI.getType()));
+ Constant *Cast
+ = ConstantExpr::getPointerBitCastOrAddrSpaceCast(TheSrc, AI.getType());
+ Instruction *NewI = ReplaceInstUsesWith(AI, Cast);
EraseInstFromFunction(*Copy);
++NumGlobalCopies;
return NewI;