summaryrefslogtreecommitdiff
path: root/lib/Analysis/MemoryBuiltins.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-06-18 21:46:23 +0000
committerChris Lattner <sabre@nondot.org>2011-06-18 21:46:23 +0000
commitebb2189904564c7c6193e7f23904f1ced7975480 (patch)
tree8d03ea373154d7adbd0fd79486e740472a1028c6 /lib/Analysis/MemoryBuiltins.cpp
parentfb78b33018bdd84d1879ae8a15f53d6b474982e9 (diff)
downloadllvm-ebb2189904564c7c6193e7f23904f1ced7975480.tar.gz
llvm-ebb2189904564c7c6193e7f23904f1ced7975480.tar.bz2
llvm-ebb2189904564c7c6193e7f23904f1ced7975480.tar.xz
simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryBuiltins.cpp')
-rw-r--r--lib/Analysis/MemoryBuiltins.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp
index 769c68ce42..53d4304911 100644
--- a/lib/Analysis/MemoryBuiltins.cpp
+++ b/lib/Analysis/MemoryBuiltins.cpp
@@ -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;