Use isTrueWhenEqual and isFalseWhenEqual instead of assuming that
[oota-llvm.git] / lib / Analysis / MemoryBuiltins.cpp
index 9f036f4e2ae26b14215db752bcf93ff67219da75..89f9743daa540e8d31f16c6433f75ef7b38b90bb 100644 (file)
@@ -24,7 +24,7 @@ using namespace llvm;
 //  malloc Call Utility Functions.
 //
 
-/// isMalloc - Returns true if the the value is either a malloc call or a
+/// isMalloc - Returns true if the value is either a malloc call or a
 /// bitcast of the result of a malloc call.
 bool llvm::isMalloc(const Value *I) {
   return extractMallocCall(I) || extractMallocCallFromBitCast(I);
@@ -105,9 +105,8 @@ static Value *computeArraySize(const CallInst *CI, const TargetData *TD,
   // return the multiple.  Otherwise, return NULL.
   Value *MallocArg = CI->getOperand(1);
   Value *Multiple = NULL;
-  APInt Val(TD->getTypeSizeInBits(MallocArg->getType()->getScalarType()), 0);
   if (ComputeMultiple(MallocArg, ElementSize, Multiple,
-                      Val, LookThroughSExt, TD))
+                      LookThroughSExt))
     return Multiple;
 
   return NULL;
@@ -140,7 +139,7 @@ const PointerType *llvm::getMallocType(const CallInst *CI) {
   unsigned NumOfBitCastUses = 0;
 
   // Determine if CallInst has a bitcast use.
-  for (Value::use_const_iterator UI = CI->use_begin(), E = CI->use_end();
+  for (Value::const_use_iterator UI = CI->use_begin(), E = CI->use_end();
        UI != E; )
     if (const BitCastInst *BCI = dyn_cast<BitCastInst>(*UI++)) {
       MallocType = cast<PointerType>(BCI->getDestTy());
@@ -184,7 +183,7 @@ Value *llvm::getMallocArraySize(CallInst *CI, const TargetData *TD,
 //  free Call Utility Functions.
 //
 
-/// isFreeCall - Returns true if the the value is a call to the builtin free()
+/// isFreeCall - Returns true if the value is a call to the builtin free()
 bool llvm::isFreeCall(const Value *I) {
   const CallInst *CI = dyn_cast<CallInst>(I);
   if (!CI)