aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/MemoryDependenceAnalysis.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-07-10 20:48:38 +0000
committerOwen Anderson <resistor@mac.com>2007-07-10 20:48:38 +0000
commit8e85048d7b004fb1bafd23df109cd91e4ffd5278 (patch)
treea2afc3d6134243fb7c3bc7b5d53e668b4dc162eb /lib/Analysis/MemoryDependenceAnalysis.cpp
parent202da14fe00fbafa8540baba433147a8eb526814 (diff)
downloadexternal_llvm-8e85048d7b004fb1bafd23df109cd91e4ffd5278.zip
external_llvm-8e85048d7b004fb1bafd23df109cd91e4ffd5278.tar.gz
external_llvm-8e85048d7b004fb1bafd23df109cd91e4ffd5278.tar.bz2
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.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index 4168cd6..1225ebb 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)) {