fix a bozo bug I introduced in r119930, causing a miscompile of
[oota-llvm.git] / lib / Transforms / Scalar / MemCpyOptimizer.cpp
index 087f022fe9d209f11a8a76bc838d4762104e55e4..5d867e71547d198a90443ea757a90a56a4e5ec09 100644 (file)
@@ -814,7 +814,8 @@ bool MemCpyOpt::processByValArgument(CallSite CS, unsigned ArgNo) {
 
   // Find out what feeds this byval argument.
   Value *ByValArg = CS.getArgument(ArgNo);
-  uint64_t ByValSize = TD->getTypeAllocSize(ByValArg->getType());
+  const Type *ByValTy =cast<PointerType>(ByValArg->getType())->getElementType();
+  uint64_t ByValSize = TD->getTypeAllocSize(ByValTy);
   MemDepResult DepInfo =
     MD->getPointerDependencyFrom(AliasAnalysis::Location(ByValArg, ByValSize),
                                  true, CS.getInstruction(),