[llvm-branch-commits] [llvm-branch] r100629 - /llvm/branches/ggreif/CallInst-operands/lib/Transforms/Utils/BuildLibCalls.cpp

Gabor Greif ggreif at gmail.com
Wed Apr 7 09:13:25 PDT 2010


Author: ggreif
Date: Wed Apr  7 11:13:24 2010
New Revision: 100629

URL: http://llvm.org/viewvc/llvm-project?rev=100629&view=rev
Log:
shift operands

Modified:
    llvm/branches/ggreif/CallInst-operands/lib/Transforms/Utils/BuildLibCalls.cpp

Modified: llvm/branches/ggreif/CallInst-operands/lib/Transforms/Utils/BuildLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/Transforms/Utils/BuildLibCalls.cpp?rev=100629&r1=100628&r2=100629&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/Transforms/Utils/BuildLibCalls.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/Transforms/Utils/BuildLibCalls.cpp Wed Apr  7 11:13:24 2010
@@ -379,10 +379,10 @@
   B.SetInsertPoint(BB, CI);
 
   if (Name == "__memcpy_chk") {
-    if (isFoldable(4, 3, false)) {
-      EmitMemCpy(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3),
+    if (isFoldable(3, 2, false)) {
+      EmitMemCpy(CI->getOperand(0), CI->getOperand(1), CI->getOperand(2),
                  1, B, TD);
-      replaceCall(CI->getOperand(1));
+      replaceCall(CI->getOperand(0));
       return true;
     }
     return false;
@@ -394,21 +394,21 @@
   }
 
   if (Name == "__memmove_chk") {
-    if (isFoldable(4, 3, false)) {
-      EmitMemMove(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3),
+    if (isFoldable(3, 2, false)) {
+      EmitMemMove(CI->getOperand(0), CI->getOperand(1), CI->getOperand(2),
                   1, B, TD);
-      replaceCall(CI->getOperand(1));
+      replaceCall(CI->getOperand(0));
       return true;
     }
     return false;
   }
 
   if (Name == "__memset_chk") {
-    if (isFoldable(4, 3, false)) {
-      Value *Val = B.CreateIntCast(CI->getOperand(2), B.getInt8Ty(),
+    if (isFoldable(3, 2, false)) {
+      Value *Val = B.CreateIntCast(CI->getOperand(1), B.getInt8Ty(),
                                    false);
-      EmitMemSet(CI->getOperand(1), Val,  CI->getOperand(3), B, TD);
-      replaceCall(CI->getOperand(1));
+      EmitMemSet(CI->getOperand(0), Val,  CI->getOperand(2), B, TD);
+      replaceCall(CI->getOperand(0));
       return true;
     }
     return false;
@@ -420,8 +420,8 @@
     // st[rp]cpy_chk call which may fail at runtime if the size is too long.
     // TODO: It might be nice to get a maximum length out of the possible
     // string lengths for varying.
-    if (isFoldable(3, 2, true)) {
-      Value *Ret = EmitStrCpy(CI->getOperand(1), CI->getOperand(2), B, TD,
+    if (isFoldable(2, 1, true)) {
+      Value *Ret = EmitStrCpy(CI->getOperand(0), CI->getOperand(1), B, TD,
                               Name.substr(2, 6));
       replaceCall(Ret);
       return true;
@@ -430,9 +430,9 @@
   }
 
   if (Name == "__strncpy_chk") {
-    if (isFoldable(4, 3, false)) {
-      Value *Ret = EmitStrNCpy(CI->getOperand(1), CI->getOperand(2),
-                               CI->getOperand(3), B, TD);
+    if (isFoldable(3, 2, false)) {
+      Value *Ret = EmitStrNCpy(CI->getOperand(0), CI->getOperand(1),
+                               CI->getOperand(2), B, TD);
       replaceCall(Ret);
       return true;
     }





More information about the llvm-branch-commits mailing list