Index: lib/CodeGen/MicrosoftCXXABI.cpp
===================================================================
--- lib/CodeGen/MicrosoftCXXABI.cpp	(revision 192354)
+++ lib/CodeGen/MicrosoftCXXABI.cpp	(working copy)
@@ -110,6 +110,21 @@
                                 SmallVectorImpl<CanQualType> &ArgTys);
 
   /// Non-base dtors should be emitted as delegating thunks in this ABI.
+  // FIXME: I think you're trying to answer two questions with just one function:
+  //   1) is Complete dtor the same as Base dtor?
+  //      -> has nothing to do with linkonce thunks.
+  //   2) is the Deleting dtor a linkonce thunk calling the Complete dtor?
+  //      -> has nothing to do with base/complete aliasing
+  // and it confuses the logic.
+  // The function name is also very confusing as there is a completely different
+  // concept of a (deleting) destructor thunk if you deal with vftables and
+  // multiple/virtual inheritance.
+  //
+  // How about:
+  //   a) split the function into two, answering one question each,
+  //   b) (re)name each of these two functions by usage, not by implementation,
+  //      e.g. useBaseDtorInsteadOfComplete() and useLinkOnceLinkageForDtor()
+  // ?
   bool useThunkForDtorVariant(const CXXDestructorDecl *Dtor,
                               CXXDtorType DT) const {
     return DT != Dtor_Base;
Index: lib/CodeGen/CGCXX.cpp
===================================================================
--- lib/CodeGen/CGCXX.cpp	(revision 192354)
+++ lib/CodeGen/CGCXX.cpp	(working copy)
@@ -217,11 +217,12 @@
 void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *dtor,
                                       CXXDtorType dtorType) {
   // The complete destructor is equivalent to the base destructor for
-  // classes with no virtual bases, so try to emit it as an alias.
-  if (dtorType == Dtor_Complete &&
-      !dtor->getParent()->getNumVBases() &&
-      !TryEmitDefinitionAsAlias(GlobalDecl(dtor, Dtor_Complete),
-                                GlobalDecl(dtor, Dtor_Base)))
+  // classes with no virtual bases, so try to emit it as an alias or just skip
+  // entirely if the ABI doesn't need it.
+  if (dtorType == Dtor_Complete && dtor->getParent()->getNumVBases() == 0 &&
+      (getCXXABI().useThunkForDtorVariant(dtor, Dtor_Complete) ||
+       !TryEmitDefinitionAsAlias(GlobalDecl(dtor, Dtor_Complete),
+                                 GlobalDecl(dtor, Dtor_Base))))
     return;
 
   // The base destructor is equivalent to the base destructor of its
Index: test/CodeGenCXX/microsoft-abi-structors.cpp
===================================================================
--- test/CodeGenCXX/microsoft-abi-structors.cpp	(revision 192354)
+++ test/CodeGenCXX/microsoft-abi-structors.cpp	(working copy)
@@ -293,3 +293,14 @@
 }
 
 }
+
+namespace PR17514 {
+struct C {
+  virtual ~C();
+};
+struct F : C {};
+void fn1() {
+  F first;
+  first.~F();
+}
+}
Index: test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
===================================================================
--- test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp	(revision 192354)
+++ test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp	(working copy)
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-linux | FileCheck -check-prefix LINUX %s
-// RUN: not %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -cxx-abi microsoft | FileCheck -check-prefix WIN32 %s
-// RUN: not %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 -cxx-abi microsoft | FileCheck -check-prefix WIN64 %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -cxx-abi microsoft -fno-rtti | FileCheck -check-prefix WIN32 %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 -cxx-abi microsoft -fno-rtti | FileCheck -check-prefix WIN64 %s
+// This part of the patch has nothing to do with dtors, just land it?
 
 struct Empty {};
 
