aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/MemoryBuiltins.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-07-17 15:36:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-07-17 15:36:56 +0000
commit411bd29eea3c360d5b48a18a17b5e87f5671af0e (patch)
treec8086addb211fa670a9d2b1038d8c2e453229755 /lib/Analysis/MemoryBuiltins.cpp
parent56fe8f14099930935e3870e3e823c322a85c1c89 (diff)
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 769c68ce425e..53d430491198 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;