mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-07 11:59:09 +00:00
Avoid dropping the address space when InstCombine optimizes memset
llvm-svn: 122215
This commit is contained in:
parent
16ea7f257f
commit
4ab0ea216d
@ -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…
x
Reference in New Issue
Block a user