aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Mangler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Mangler.cpp')
-rw-r--r--llvm/lib/IR/Mangler.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp
index d73f748b0584..0d66e321c396 100644
--- a/llvm/lib/IR/Mangler.cpp
+++ b/llvm/lib/IR/Mangler.cpp
@@ -94,15 +94,18 @@ static void addByteCountSuffix(raw_ostream &OS, const Function *F,
const DataLayout &DL) {
// Calculate arguments size total.
unsigned ArgWords = 0;
+
+ const unsigned PtrSize = DL.getPointerSize();
+
for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
AI != AE; ++AI) {
- Type *Ty = AI->getType();
// 'Dereference' type in case of byval or inalloca parameter attribute.
- if (AI->hasByValOrInAllocaAttr())
- Ty = cast<PointerType>(Ty)->getElementType();
+ uint64_t AllocSize = AI->hasPassPointeeByValueAttr() ?
+ AI->getPassPointeeByValueCopySize(DL) :
+ DL.getTypeAllocSize(AI->getType());
+
// Size should be aligned to pointer size.
- unsigned PtrSize = DL.getPointerSize();
- ArgWords += alignTo(DL.getTypeAllocSize(Ty), PtrSize);
+ ArgWords += alignTo(AllocSize, PtrSize);
}
OS << '@' << ArgWords;