[llvm-branch-commits] [llvm-branch] r100300 - /llvm/branches/ggreif/CallInst-operands/lib/Analysis/MemoryBuiltins.cpp

Gabor Greif ggreif at gmail.com
Sat Apr 3 17:36:10 PDT 2010


Author: ggreif
Date: Sat Apr  3 19:36:09 2010
New Revision: 100300

URL: http://llvm.org/viewvc/llvm-project?rev=100300&view=rev
Log:
malloc arg is at pos 0

Modified:
    llvm/branches/ggreif/CallInst-operands/lib/Analysis/MemoryBuiltins.cpp

Modified: llvm/branches/ggreif/CallInst-operands/lib/Analysis/MemoryBuiltins.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/Analysis/MemoryBuiltins.cpp?rev=100300&r1=100299&r2=100300&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/Analysis/MemoryBuiltins.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/Analysis/MemoryBuiltins.cpp Sat Apr  3 19:36:09 2010
@@ -103,7 +103,7 @@
 
   // If malloc calls' arg can be determined to be a multiple of ElementSize,
   // return the multiple.  Otherwise, return NULL.
-  Value *MallocArg = CI->getOperand(1);
+  Value *MallocArg = CI->getOperand(0);
   Value *Multiple = NULL;
   if (ComputeMultiple(MallocArg, ElementSize, Multiple,
                       LookThroughSExt))
@@ -120,7 +120,7 @@
   Value *ArraySize = computeArraySize(CI, TD);
 
   if (ArraySize &&
-      ArraySize != ConstantInt::get(CI->getOperand(1)->getType(), 1))
+      ArraySize != ConstantInt::get(CI->getOperand(0)->getType(), 1))
     return CI;
 
   // CI is a non-array malloc or we can't figure out that it is an array malloc.





More information about the llvm-branch-commits mailing list