[llvm] r176646 - Simplify code. No functionality change.

Jakub Staszak kubastaszak at gmail.com
Thu Mar 7 12:22:39 PST 2013


Author: kuba
Date: Thu Mar  7 14:22:39 2013
New Revision: 176646

URL: http://llvm.org/viewvc/llvm-project?rev=176646&view=rev
Log:
Simplify code. No functionality change.

Modified:
    llvm/trunk/lib/Analysis/MemoryBuiltins.cpp

Modified: llvm/trunk/lib/Analysis/MemoryBuiltins.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryBuiltins.cpp?rev=176646&r1=176645&r2=176646&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp Thu Mar  7 14:22:39 2013
@@ -225,9 +225,9 @@ const CallInst *llvm::isArrayMalloc(cons
   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;





More information about the llvm-commits mailing list