mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-29 14:40:25 +00:00
Avoid dropping the address space when InstCombine optimizes memset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122215 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d8ff7eca8c
commit
55fb9b0fcf
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user