Extend getMallocArraySize() to determine the array size if the malloc argument is:
authorVictor Hernandez <vhernandez@apple.com>
Wed, 28 Oct 2009 20:18:55 +0000 (20:18 +0000)
committerVictor Hernandez <vhernandez@apple.com>
Wed, 28 Oct 2009 20:18:55 +0000 (20:18 +0000)
commit90f48e7c91a8faa875ba889ca66b137ffd46e34a
treeaa65e67f70dcc037d749a7a91ab809becdeafc87
parent5c00b4af61bb6abff2fb28ddd904808623a7db23
Extend getMallocArraySize() to determine the array size if the malloc argument is:
ArraySize * ElementSize
ElementSize * ArraySize
ArraySize << log2(ElementSize)
ElementSize << log2(ArraySize)

Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic.
Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85421 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/MemoryBuiltins.h
lib/Analysis/MemoryBuiltins.cpp
lib/Transforms/IPO/GlobalOpt.cpp
test/Transforms/GlobalOpt/heap-sra-3.ll [new file with mode: 0644]
test/Transforms/GlobalOpt/heap-sra-4.ll [new file with mode: 0644]