diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index 4168cd6fb18..1225ebbe884 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(QI)) { pointer = AI; if (ConstantInt* C = dyn_cast(AI->getArraySize())) - pointerSize = C->getZExtValue(); + pointerSize = C->getZExtValue() * TD.getTypeSize(AI->getAllocatedType()); else pointerSize = ~0UL; } else if (VAArgInst* V = dyn_cast(QI)) { @@ -180,7 +180,7 @@ Instruction* MemoryDependenceAnalysis::getDependency(Instruction* query, } else if (AllocationInst* AI = dyn_cast(QI)) { pointer = AI; if (ConstantInt* C = dyn_cast(AI->getArraySize())) - pointerSize = C->getZExtValue(); + pointerSize = C->getZExtValue() * TD.getTypeSize(AI->getAllocatedType()); else pointerSize = ~0UL; } else if (VAArgInst* V = dyn_cast(QI)) {