simplify some code.
authorChris Lattner <sabre@nondot.org>
Sat, 18 Jun 2011 21:46:23 +0000 (21:46 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 18 Jun 2011 21:46:23 +0000 (21:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133362 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/MemoryBuiltins.cpp

index 769c68ce425ed8296e7bfe1830b5c9f758bb1f35..53d430491198a44c8f8a7626020f7b3f9936c8a4 100644 (file)
@@ -50,13 +50,8 @@ static bool isMallocCall(const CallInst *CI) {
   const FunctionType *FTy = Callee->getFunctionType();
   if (FTy->getNumParams() != 1)
     return false;
-  if (IntegerType *ITy = dyn_cast<IntegerType>(FTy->param_begin()->get())) {
-    if (ITy->getBitWidth() != 32 && ITy->getBitWidth() != 64)
-      return false;
-    return true;
-  }
-
-  return false;
+  return FTy->getParamType(0)->isIntegerTy(32) ||
+         FTy->getParamType(0)->isIntegerTy(64);
 }
 
 /// extractMallocCall - Returns the corresponding CallInst if the instruction
@@ -211,7 +206,7 @@ const CallInst *llvm::isFreeCall(const Value *I) {
     return 0;
   if (FTy->getNumParams() != 1)
     return 0;
-  if (FTy->param_begin()->get() != Type::getInt8PtrTy(Callee->getContext()))
+  if (FTy->getParamType(0) != Type::getInt8PtrTy(Callee->getContext()))
     return 0;
 
   return CI;