Move the piece of code up that skips the padding argument. Without this change,
padding insertion will not work if the coerced type is not a structure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147786 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 962339a..72b40d3 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -988,6 +988,10 @@
case ABIArgInfo::Extend:
case ABIArgInfo::Direct: {
+ // Skip the dummy padding argument.
+ if (ArgI.getPaddingType())
+ ++AI;
+
// If we have the trivial case, handle it with no muss and fuss.
if (!isa<llvm::StructType>(ArgI.getCoerceToType()) &&
ArgI.getCoerceToType() == ConvertType(Ty) &&
@@ -1030,10 +1034,6 @@
llvm::PointerType::getUnqual(ArgI.getCoerceToType()));
}
- // Skip the dummy padding argument.
- if (ArgI.getPaddingType())
- ++AI;
-
// If the coerce-to type is a first class aggregate, we flatten it and
// pass the elements. Either way is semantically identical, but fast-isel
// and the optimizer generally likes scalar values better than FCAs.