Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86676 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Victor Hernandez
2009-11-10 08:32:25 +00:00
parent 2b6705f5e7
commit 8e345a1c41
4 changed files with 30 additions and 110 deletions

View File

@@ -44,9 +44,7 @@ CallInst *extractMallocCallFromBitCast(Value *I);
/// isArrayMalloc - Returns the corresponding CallInst if the instruction
/// is a call to malloc whose array size can be determined and the array size
/// is not constant 1. Otherwise, return NULL.
CallInst *isArrayMalloc(Value *I, const TargetData *TD);
const CallInst *isArrayMalloc(const Value *I,
const TargetData *TD);
const CallInst *isArrayMalloc(const Value *I, const TargetData *TD);
/// getMallocType - Returns the PointerType resulting from the malloc call.
/// The PointerType depends on the number of bitcast uses of the malloc call:
@@ -67,7 +65,8 @@ const Type *getMallocAllocatedType(const CallInst *CI);
/// then return that multiple. For non-array mallocs, the multiple is
/// constant 1. Otherwise, return NULL for mallocs whose array size cannot be
/// determined.
Value *getMallocArraySize(CallInst *CI, const TargetData *TD);
Value *getMallocArraySize(CallInst *CI, const TargetData *TD,
bool LookThroughSExt = false);
//===----------------------------------------------------------------------===//
// free Call Utility Functions.