x86_32 ABI: Don't try and expand structures with bitfields.
- This is an ABI incompatiblity, but this is not likely to be a huge
deal in practice. For now we at least generate self consistent code
instead of crashing.
- <rdar://problem/6657601> x86-32 ABI: Bitfields in small structures
are not passed correctly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66713 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index e9ac5c9..9e52cbb 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -215,14 +215,14 @@
if (!is32Or64BitBasicType(FD->getType(), Context))
return false;
- // If this is a bit-field we need to make sure it is still a
- // 32-bit or 64-bit type.
- if (Expr *BW = FD->getBitWidth()) {
- unsigned Width = BW->getIntegerConstantExprValue(Context).getZExtValue();
- if (Width <= 16)
- return false;
- }
+ // FIXME: Reject bitfields wholesale; there are two problems, we
+ // don't know how to expand them yet, and the predicate for
+ // telling if a bitfield still counts as "basic" is more
+ // complicated than what we were doing previously.
+ if (FD->isBitField())
+ return false;
}
+
return true;
}