[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp

Reid Spencer reid at x10sys.com
Tue Apr 26 15:46:34 PDT 2005



Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.9 -> 1.10
---
Log message:

memcpy returns void!!!!!


---
Diffs of the changes:  (+2 -8)

 SimplifyLibCalls.cpp |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.9 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.10
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.9	Tue Apr 26 14:55:57 2005
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp	Tue Apr 26 17:46:23 2005
@@ -205,8 +205,7 @@
       args.push_back(PointerType::get(Type::SByteTy));
       args.push_back(Type::IntTy);
       args.push_back(Type::IntTy);
-      memcpy_type = FunctionType::get(
-        PointerType::get(Type::SByteTy), args, false);
+      memcpy_type = FunctionType::get(Type::VoidTy, args, false);
     }
     return memcpy_type;
   }
@@ -568,10 +567,7 @@
     switch (len)
     {
       case 0:
-        // Just replace with the destination parameter since a zero length
-        // memcpy is a no-op.
-        ci->replaceAllUsesWith(
-            new CastInst(dest,PointerType::get(Type::VoidTy),"",ci));
+        // The memcpy is a no-op so just dump its call.
         ci->eraseFromParent();
         return true;
       case 1:
@@ -595,8 +591,6 @@
     }
     LoadInst* LI = new LoadInst(SrcCast,"",ci);
     StoreInst* SI = new StoreInst(LI, DestCast, ci);
-    ci->replaceAllUsesWith(
-      new CastInst(dest,PointerType::get(Type::VoidTy),"",ci));
     ci->eraseFromParent();
     return true;
   }






More information about the llvm-commits mailing list