diff options
author | Mon P Wang <wangmp@apple.com> | 2010-12-20 01:05:30 +0000 |
---|---|---|
committer | Mon P Wang <wangmp@apple.com> | 2010-12-20 01:05:30 +0000 |
commit | 1991c47ec144e69bf3d6cb8f07ba03026e80b7b6 (patch) | |
tree | a129141451a85fa92f268f05ff8dbafbc8e02e92 | |
parent | 9c26d2711b9c563f3ec90e97c0946e30cb896973 (diff) | |
download | bcm5719-llvm-1991c47ec144e69bf3d6cb8f07ba03026e80b7b6.tar.gz bcm5719-llvm-1991c47ec144e69bf3d6cb8f07ba03026e80b7b6.zip |
Avoid dropping the address space when InstCombine optimizes memset
llvm-svn: 122215
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index d53f3291e71..58c8f5fc460 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -234,7 +234,9 @@ Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) { const Type *ITy = IntegerType::get(MI->getContext(), Len*8); // n=1 -> i8. Value *Dest = MI->getDest(); - Dest = Builder->CreateBitCast(Dest, PointerType::getUnqual(ITy)); + unsigned DstAddrSp = cast<PointerType>(Dest->getType())->getAddressSpace(); + Type *NewDstPtrTy = PointerType::get(ITy, DstAddrSp); + Dest = Builder->CreateBitCast(Dest, NewDstPtrTy); // Alignment 0 is identity for alignment 1 for memset, but not store. if (Alignment == 0) Alignment = 1; |