aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Staszak <kubastaszak@gmail.com>2013-03-07 20:22:39 +0000
committerJakub Staszak <kubastaszak@gmail.com>2013-03-07 20:22:39 +0000
commitb1b6c170819120e535ef706f58041bb6caebe35d (patch)
tree01c8172c63ab2acdf0040c48e5d0358fb291ee48
parent4a521da51a4eea92d76a7d635b63ab9f8a57c936 (diff)
Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176646 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/MemoryBuiltins.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp
index 26a013fab6..a1eea1c850 100644
--- a/lib/Analysis/MemoryBuiltins.cpp
+++ b/lib/Analysis/MemoryBuiltins.cpp
@@ -225,9 +225,9 @@ const CallInst *llvm::isArrayMalloc(const Value *I,
const CallInst *CI = extractMallocCall(I, TLI);
Value *ArraySize = computeArraySize(CI, TD, TLI);
- if (ArraySize &&
- ArraySize != ConstantInt::get(CI->getArgOperand(0)->getType(), 1))
- return CI;
+ if (ConstantInt *ConstSize = dyn_cast_or_null<ConstantInt>(ArraySize))
+ if (ConstSize->isOne())
+ return CI;
// CI is a non-array malloc or we can't figure out that it is an array malloc.
return 0;