diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index c3d5ee19d682b9937cae77be33093400bd5ce5cf..b23ae304a8225bfe05fbbce18f0c6715e1870edf 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -700,8 +700,8 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty) const {
         return getIndirectResult(Ty);
     }
 
-    // Ignore empty structs.
-    if (Ty->isStructureType() && getContext().getTypeSize(Ty) == 0)
+    // Ignore empty structs/unions.
+    if (Ty->isRecordType() && getContext().getTypeSize(Ty) == 0)
       return ABIArgInfo::getIgnore();
 
     // Expand small (<= 128-bit) record types when we know that the stack layout
diff --git a/test/CodeGen/x86_32-arguments-darwin.c b/test/CodeGen/x86_32-arguments-darwin.c
index c3af7fbc0473b3319e0eb1f7244acd8d4045eee3..b31262fc96c07a2eb23a08298626554cac3b9d6b 100644
--- a/test/CodeGen/x86_32-arguments-darwin.c
+++ b/test/CodeGen/x86_32-arguments-darwin.c
@@ -280,3 +280,7 @@ void f56(char a0, struct s56_0 a1,
 // CHECK: call void @f57(
 struct s57 { _Complex int x; };
 void f57(struct s57 x) {} void f57a(void) { f57((struct s57){1}); }
+
+union u58 {};
+void f58(union u58 x) {}
+// CHECK: define void @f58()