When performing value-initialization for a class with a non-trivial,
implicitly-defined default constructor, zero-initialize the memory
before calling the default constructor. Previously, we would only
zero-initialize in the case of a trivial default constructor.

Also, simplify the hideous logic that determines when we have a
trivial default constructor and, therefore, don't need to emit any
call at all.

llvm-svn: 111779
diff --git a/clang/test/CodeGenCXX/value-init.cpp b/clang/test/CodeGenCXX/value-init.cpp
index 3273628..6977e73 100644
--- a/clang/test/CodeGenCXX/value-init.cpp
+++ b/clang/test/CodeGenCXX/value-init.cpp
@@ -93,4 +93,22 @@
     // CHECK: ret i32
     return S().i;
   }
+
+  struct X0 {
+    X0() { }
+    int x;
+  };
+
+  struct X1 : X0 {
+    int x1;
+    void f();
+  };
+
+  // CHECK: define void @_ZN8zeroinit9testX0_X1Ev
+  void testX0_X1() {
+    // CHECK: call void @llvm.memset.p0i8.i64
+    // CHECK-NEXT: call void @_ZN8zeroinit2X1C1Ev
+    // CHECK-NEXT: call void @_ZN8zeroinit2X11fEv
+    X1().f();
+  }
 }