autoupgrade memcpy/memmove/memset with signed counts.
authorChris Lattner <sabre@nondot.org>
Thu, 9 Mar 2006 18:42:10 +0000 (18:42 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 9 Mar 2006 18:42:10 +0000 (18:42 +0000)
 CVS: ----------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26654 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AutoUpgrade.cpp

index 55cde239933bee0d72104d460632d2502e6e80c5..689a32f958d95e4ba423092f8f9d8b66a4a958ed 100644 (file)
@@ -84,10 +84,18 @@ static Function *getUpgradedIntrinsic(Function *F) {
   case 'm':
     if (Name == "llvm.memcpy" || Name == "llvm.memset" || 
         Name == "llvm.memmove") {
-      if (F->getFunctionType()->getParamType(2) == Type::UIntTy)
-        return M->getOrInsertFunction(Name+".i32", F->getFunctionType());
-      if (F->getFunctionType()->getParamType(2) == Type::ULongTy)
-        return M->getOrInsertFunction(Name+".i64", F->getFunctionType());
+      if (F->getFunctionType()->getParamType(2) == Type::UIntTy ||
+          F->getFunctionType()->getParamType(2) == Type::IntTy)
+        return M->getOrInsertFunction(Name+".i32", Type::VoidTy,
+                                      PointerType::get(Type::SByteTy),
+                                      F->getFunctionType()->getParamType(1),
+                                      Type::UIntTy, Type::UIntTy, NULL);
+      if (F->getFunctionType()->getParamType(2) == Type::ULongTy ||
+          F->getFunctionType()->getParamType(2) == Type::LongTy)
+        return M->getOrInsertFunction(Name+".i64", Type::VoidTy,
+                                      PointerType::get(Type::SByteTy),
+                                      F->getFunctionType()->getParamType(1),
+                                      Type::ULongTy, Type::UIntTy, NULL);
     }
     break;
   case 's':