diff options
author | Owen Anderson <resistor@mac.com> | 2007-07-10 20:48:38 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-07-10 20:48:38 +0000 |
commit | 8e85048d7b004fb1bafd23df109cd91e4ffd5278 (patch) | |
tree | a2afc3d6134243fb7c3bc7b5d53e668b4dc162eb /lib/Analysis/MemoryDependenceAnalysis.cpp | |
parent | 202da14fe00fbafa8540baba433147a8eb526814 (diff) |
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
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/MemoryDependenceAnalysis.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index 4168cd6fb1..1225ebbe88 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -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)) { |