mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-24 08:33:39 +00:00
Fix PR1181 and CodeGen/CBackend/2007-02-05-memset.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33957 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ba1469278e
commit
7d6f77db28
@ -394,17 +394,27 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
|
|||||||
}
|
}
|
||||||
case Intrinsic::memset_i32: {
|
case Intrinsic::memset_i32: {
|
||||||
static Constant *MemsetFCache = 0;
|
static Constant *MemsetFCache = 0;
|
||||||
Value * Size = cast<Value>(CI->op_end()-1);
|
Value *Size = cast<Value>(CI->op_end()-1);
|
||||||
if (Size->getType() != TD.getIntPtrType())
|
const Type *IntPtr = TD.getIntPtrType();
|
||||||
Size->replaceAllUsesWith(new ZExtInst(Size, TD.getIntPtrType()));
|
if (Size->getType()->getPrimitiveSizeInBits() <
|
||||||
|
IntPtr->getPrimitiveSizeInBits())
|
||||||
|
Size = new ZExtInst(Size, IntPtr, "", CI);
|
||||||
|
else if (Size->getType()->getPrimitiveSizeInBits() >
|
||||||
|
IntPtr->getPrimitiveSizeInBits())
|
||||||
|
Size = new TruncInst(Size, IntPtr, "", CI);
|
||||||
ReplaceCallWith("memset", CI, CI->op_begin()+1, CI->op_end()-1,
|
ReplaceCallWith("memset", CI, CI->op_begin()+1, CI->op_end()-1,
|
||||||
(*(CI->op_begin()+1))->getType(), MemsetFCache);
|
(*(CI->op_begin()+1))->getType(), MemsetFCache);
|
||||||
}
|
}
|
||||||
case Intrinsic::memset_i64: {
|
case Intrinsic::memset_i64: {
|
||||||
static Constant *MemsetFCache = 0;
|
static Constant *MemsetFCache = 0;
|
||||||
Value * Size = cast<Value>(CI->op_end()-1);
|
Value *Size = cast<Value>(CI->op_end()-1);
|
||||||
if (Size->getType() != TD.getIntPtrType())
|
const Type *IntPtr = TD.getIntPtrType();
|
||||||
Size->replaceAllUsesWith(new TruncInst(Size, TD.getIntPtrType()));
|
if (Size->getType()->getPrimitiveSizeInBits() <
|
||||||
|
IntPtr->getPrimitiveSizeInBits())
|
||||||
|
Size = new ZExtInst(Size, IntPtr, "", CI);
|
||||||
|
else if (Size->getType()->getPrimitiveSizeInBits() >
|
||||||
|
IntPtr->getPrimitiveSizeInBits())
|
||||||
|
Size = new TruncInst(Size, IntPtr, "", CI);
|
||||||
ReplaceCallWith("memset", CI, CI->op_begin()+1, CI->op_end()-1,
|
ReplaceCallWith("memset", CI, CI->op_begin()+1, CI->op_end()-1,
|
||||||
(*(CI->op_begin()+1))->getType(), MemsetFCache);
|
(*(CI->op_begin()+1))->getType(), MemsetFCache);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user