diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 88bf8fe122..c51ce91371 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -3222,11 +3222,12 @@ MipsABIInfo::returnAggregateInRegs(QualType RetTy, uint64_t Size) const { } ABIArgInfo MipsABIInfo::classifyReturnType(QualType RetTy) const { - if (RetTy->isVoidType()) + uint64_t Size = getContext().getTypeSize(RetTy); + + if (RetTy->isVoidType() || Size == 0) return ABIArgInfo::getIgnore(); if (isAggregateTypeForABI(RetTy)) { - uint64_t Size = getContext().getTypeSize(RetTy); if (Size <= 128) { if (RetTy->isAnyComplexType()) return ABIArgInfo::getDirect();