mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-11 13:44:28 +00:00
Calculate the size of a array allocation correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
202da14fe0
commit
8e85048d7b
@ -64,7 +64,7 @@ Instruction* MemoryDependenceAnalysis::getCallSiteDependency(CallSite C, bool lo
|
||||
} else if (AllocationInst* AI = dyn_cast<AllocationInst>(QI)) {
|
||||
pointer = AI;
|
||||
if (ConstantInt* C = dyn_cast<ConstantInt>(AI->getArraySize()))
|
||||
pointerSize = C->getZExtValue();
|
||||
pointerSize = C->getZExtValue() * TD.getTypeSize(AI->getAllocatedType());
|
||||
else
|
||||
pointerSize = ~0UL;
|
||||
} else if (VAArgInst* V = dyn_cast<VAArgInst>(QI)) {
|
||||
@ -180,7 +180,7 @@ Instruction* MemoryDependenceAnalysis::getDependency(Instruction* query,
|
||||
} else if (AllocationInst* AI = dyn_cast<AllocationInst>(QI)) {
|
||||
pointer = AI;
|
||||
if (ConstantInt* C = dyn_cast<ConstantInt>(AI->getArraySize()))
|
||||
pointerSize = C->getZExtValue();
|
||||
pointerSize = C->getZExtValue() * TD.getTypeSize(AI->getAllocatedType());
|
||||
else
|
||||
pointerSize = ~0UL;
|
||||
} else if (VAArgInst* V = dyn_cast<VAArgInst>(QI)) {
|
||||
|
Loading…
Reference in New Issue
Block a user