diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-28 22:28:00 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-28 22:28:00 +0000 |
| commit | c7765617d2234b4245921c4be44b2ee11a9cb49a (patch) | |
| tree | 834683f4346c0431d4a53eae8a1a3e16b933c686 /llvm/lib/CodeGen/IntrinsicLowering.cpp | |
| parent | 326bf785a258ce41f0e86eed82b3250535dc4a46 (diff) | |
| download | bcm5719-llvm-c7765617d2234b4245921c4be44b2ee11a9cb49a.tar.gz bcm5719-llvm-c7765617d2234b4245921c4be44b2ee11a9cb49a.zip | |
For PR1138:
Force memcpy to be the 32-bit variant. Since this is only used with
CBE and lli which both target 32-bit machines, this should be okay.
llvm-svn: 33608
Diffstat (limited to 'llvm/lib/CodeGen/IntrinsicLowering.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/IntrinsicLowering.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/IntrinsicLowering.cpp b/llvm/lib/CodeGen/IntrinsicLowering.cpp index 72a1d1485b4..65835da4f0a 100644 --- a/llvm/lib/CodeGen/IntrinsicLowering.cpp +++ b/llvm/lib/CodeGen/IntrinsicLowering.cpp @@ -77,13 +77,17 @@ void IntrinsicLowering::AddPrototypes(Module &M) { break; case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: - EnsureFunctionExists(M, "memcpy", I->arg_begin(), --I->arg_end(), - I->arg_begin()->getType()); + M.getOrInsertFunction("memcpy", PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), Type::Int32Ty, + (Type *)0); break; case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: - EnsureFunctionExists(M, "memmove", I->arg_begin(), --I->arg_end(), - I->arg_begin()->getType()); + M.getOrInsertFunction("memmove", PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), Type::Int32Ty, + (Type *)0); break; case Intrinsic::memset_i32: case Intrinsic::memset_i64: @@ -360,6 +364,9 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { } case Intrinsic::memcpy_i64: { static Constant *MemcpyFCache = 0; + Value * Size = cast<Value>(CI->op_end()-1); + if (Size->getType() != Type::Int32Ty) + Size->replaceAllUsesWith(new TruncInst(Size, Type::Int32Ty)); ReplaceCallWith("memcpy", CI, CI->op_begin()+1, CI->op_end()-1, (*(CI->op_begin()+1))->getType(), MemcpyFCache); break; |

