Slight cleanup, and fix for va_arg on architectures where va_list is a
struct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62585 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 043f284..30f8c34 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -53,12 +53,7 @@
case Builtin::BI__builtin_stdarg_start:
case Builtin::BI__builtin_va_start:
case Builtin::BI__builtin_va_end: {
- Value *ArgValue;
- if (CGM.getContext().getBuiltinVaListType()->isArrayType()) {
- ArgValue = EmitScalarExpr(E->getArg(0));
- } else {
- ArgValue = EmitLValue(E->getArg(0)).getAddress();
- }
+ Value *ArgValue = EmitVAListRef(E->getArg(0));;
const llvm::Type *DestType =
llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
if (ArgValue->getType() != DestType)
@@ -70,14 +65,8 @@
return RValue::get(Builder.CreateCall(CGM.getIntrinsic(inst), ArgValue));
}
case Builtin::BI__builtin_va_copy: {
- Value *DstPtr, *SrcPtr;
- if (CGM.getContext().getBuiltinVaListType()->isArrayType()) {
- DstPtr = EmitScalarExpr(E->getArg(0));
- SrcPtr = EmitScalarExpr(E->getArg(1));
- } else {
- DstPtr = EmitLValue(E->getArg(0)).getAddress();
- SrcPtr = EmitLValue(E->getArg(1)).getAddress();
- }
+ Value *DstPtr = EmitVAListRef(E->getArg(0));
+ Value *SrcPtr = EmitVAListRef(E->getArg(1));
const llvm::Type *Type =
llvm::PointerType::getUnqual(llvm::Type::Int8Ty);