diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 3ad1df1..0322f72 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -84,14 +84,16 @@ CodeGenTypes::arrangeFunctionType(CanQual<FunctionNoProtoType> FTNP) {
 /// stored.
 static const CGFunctionInfo &arrangeFunctionType(CodeGenTypes &CGT,
                                   SmallVectorImpl<CanQualType> &argTypes,
-                                             CanQual<FunctionProtoType> FTP) {
+                                             CanQual<FunctionProtoType> FTP,
+                                             const FunctionType::ExtInfo &ext_info,
+                                             bool isInstance) {
   RequiredArgs required = RequiredArgs::forPrototypePlus(FTP, argTypes.size());
   // FIXME: Kill copy.
   for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i)
     argTypes.push_back(FTP->getArgType(i));
   CanQualType resultType = FTP->getResultType().getUnqualifiedType();
   return CGT.arrangeFunctionType(resultType, argTypes,
-                                 FTP->getExtInfo(), required);
+                                 ext_info, required, isInstance);
 }
 
 /// Arrange the argument and result information for a value of the
@@ -99,7 +101,7 @@ static const CGFunctionInfo &arrangeFunctionType(CodeGenTypes &CGT,
 const CGFunctionInfo &
 CodeGenTypes::arrangeFunctionType(CanQual<FunctionProtoType> FTP) {
   SmallVector<CanQualType, 16> argTypes;
-  return ::arrangeFunctionType(*this, argTypes, FTP);
+  return ::arrangeFunctionType(*this, argTypes, FTP, FTP->getExtInfo(), false);
 }
 
 static CallingConv getCallingConventionForDecl(const Decl *D) {
@@ -135,7 +137,8 @@ CodeGenTypes::arrangeCXXMethodType(const CXXRecordDecl *RD,
   argTypes.push_back(GetThisType(Context, RD));
 
   return ::arrangeFunctionType(*this, argTypes,
-              FTP->getCanonicalTypeUnqualified().getAs<FunctionProtoType>());
+              FTP->getCanonicalTypeUnqualified().getAs<FunctionProtoType>(),
+              FTP->getExtInfo(), true);
 }
 
 /// Arrange the argument and result information for a declaration or
@@ -147,13 +150,11 @@ CodeGenTypes::arrangeCXXMethodDeclaration(const CXXMethodDecl *MD) {
   assert(!isa<CXXConstructorDecl>(MD) && "wrong method for contructors!");
   assert(!isa<CXXDestructorDecl>(MD) && "wrong method for destructors!");
 
-  CanQual<FunctionProtoType> prototype = GetFormalType(MD);
-
   if (MD->isInstance()) {
-    // The abstract case is perfectly fine.
-    return arrangeCXXMethodType(MD->getParent(), prototype.getTypePtr());
+    return arrangeCXXMethodType(MD->getParent(), MD->getType()->castAs<FunctionProtoType>());
   }
 
+  CanQual<FunctionProtoType> prototype = GetFormalType(MD);
   return arrangeFunctionType(prototype);
 }
 
@@ -176,7 +177,7 @@ CodeGenTypes::arrangeCXXConstructorDeclaration(const CXXConstructorDecl *D,
   for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i)
     argTypes.push_back(FTP->getArgType(i));
 
-  return arrangeFunctionType(resultType, argTypes, FTP->getExtInfo(), required);
+  return arrangeFunctionType(resultType, argTypes, FTP->getExtInfo(), required, true);
 }
 
 /// Arrange the argument and result information for a declaration,
@@ -195,7 +196,7 @@ CodeGenTypes::arrangeCXXDestructor(const CXXDestructorDecl *D,
   assert(FTP->getNumArgs() == 0 && "dtor with formal parameters");
 
   return arrangeFunctionType(resultType, argTypes, FTP->getExtInfo(),
-                             RequiredArgs::All);
+                             RequiredArgs::All, true);
 }
 
 /// Arrange the argument and result information for the declaration or
@@ -341,15 +342,20 @@ const CGFunctionInfo &CodeGenTypes::arrangeNullaryFunction() {
 const CGFunctionInfo &
 CodeGenTypes::arrangeFunctionType(CanQualType resultType,
                                   ArrayRef<CanQualType> argTypes,
-                                  const FunctionType::ExtInfo &info,
-                                  RequiredArgs required) {
+                                  const FunctionType::ExtInfo &ext_info,
+                                  RequiredArgs required, bool isInstance) {
 #ifndef NDEBUG
   for (ArrayRef<CanQualType>::const_iterator
          I = argTypes.begin(), E = argTypes.end(); I != E; ++I)
     assert(I->isCanonicalAsParam());
 #endif
 
-  unsigned CC = ClangCallConvToLLVMCallConv(info.getCC());
+  CallingConv CC_to_use = ext_info.getCC();
+  if (isInstance && CC_to_use == CC_Default)
+    CC_to_use = Context.getDefaultMethodCallConv();
+
+  FunctionType::ExtInfo info = ext_info.withCallingConv(CC_to_use);
+  unsigned CC = ClangCallConvToLLVMCallConv(CC_to_use);
 
   // Lookup or create unique function info.
   llvm::FoldingSetNodeID ID;
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
index dc318be..2d263f8 100644
--- a/lib/CodeGen/CGExprCXX.cpp
+++ b/lib/CodeGen/CGExprCXX.cpp
@@ -50,8 +50,14 @@ RValue CodeGenFunction::EmitCXXMemberCall(const CXXMethodDecl *MD,
   // And the rest of the call args.
   EmitCallArgs(Args, FPT, ArgBeg, ArgEnd);
 
+
+  CallingConv overrideDefaultCC = getContext().getDefaultMethodCallConv();
+  FunctionType::ExtInfo ext_info = FPT->getExtInfo();
+  if (overrideDefaultCC != CC_Default && ext_info.getCC() == CC_Default)
+    ext_info = ext_info.withCallingConv(overrideDefaultCC);
+
   return EmitCall(CGM.getTypes().arrangeFunctionCall(FPT->getResultType(), Args,
-                                                     FPT->getExtInfo(),
+                                                     ext_info,
                                                      required),
                   Callee, ReturnValue, Args, MD);
 }
diff --git a/lib/CodeGen/CodeGenTypes.h b/lib/CodeGen/CodeGenTypes.h
index ba2b3ae..283cb17 100644
--- a/lib/CodeGen/CodeGenTypes.h
+++ b/lib/CodeGen/CodeGenTypes.h
@@ -205,10 +205,12 @@ public:
   /// This is the "core" routine to which all the others defer.
   ///
   /// \param argTypes - must all actually be canonical as params
+  /// \param isInstance - true iff the function is a class instance method
+  //  or ctor/dtor.
   const CGFunctionInfo &arrangeFunctionType(CanQualType returnType,
                                             ArrayRef<CanQualType> argTypes,
                                             const FunctionType::ExtInfo &info,
-                                            RequiredArgs args);
+                                            RequiredArgs args, bool isInstance = false);
 
   /// \brief Compute a new LLVM record layout object for the given record.
   CGRecordLayout *ComputeRecordLayout(const RecordDecl *D,
diff --git a/test/CodeGenCXX/microsoft-abi-methods.cpp b/test/CodeGenCXX/microsoft-abi-methods.cpp
new file mode 100644
index 0000000..773b75c
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-methods.cpp
@@ -0,0 +1,76 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+
+class C {
+ public:
+  void simple_method() {}
+
+  void __cdecl cdecl_method() {}
+
+  static void static_method() {}
+
+  int a;
+};
+
+void call_simple_method() {
+  C instance;
+
+  instance.simple_method();
+// Make sure that the call uses the right calling convention:
+// CHECK: call x86_thiscallcc void @"\01?simple_method@C@@QAEXXZ"
+// CHECK: ret
+
+// Make sure that the definition uses the right calling convention:
+// CHECK: define linkonce_odr x86_thiscallcc void @"\01?simple_method@C@@QAEXXZ"
+// CHECK: ret
+}
+
+void call_cdecl_method() {
+  C instance;
+  instance.cdecl_method();
+// Make sure that the call uses the right calling convention:
+// CHECK: call void @"\01?cdecl_method@C@@QAAXXZ"
+// CHECK: ret
+
+// Make sure that the definition uses the right calling convention:
+// CHECK: define linkonce_odr void @"\01?cdecl_method@C@@QAAXXZ"
+// CHECK: ret
+}
+
+void call_static_method() {
+  C::static_method();
+// Make sure that the call uses the right calling convention:
+// CHECK: call void @"\01?static_method@C@@SAXXZ"
+// CHECK: ret
+
+// Make sure that the definition uses the right calling convention:
+// CHECK: define linkonce_odr void @"\01?static_method@C@@SAXXZ"
+}
+
+class Base {
+ public:
+  Base() {}
+  ~Base() {}
+};
+
+class Child: public Base { };
+
+void constructors() {
+  Child c;
+// Make sure that the Base constructor call in the Child constructor uses
+// the right calling convention:
+// CHECK: define linkonce_odr x86_thiscallcc void @"\01??0Child@@QAE@XZ"
+// CHECK: call x86_thiscallcc void @"\01??0Base@@QAE@XZ"
+// CHECK: ret
+
+// Make sure that the Base destructor call in the Child denstructor uses
+// the right calling convention:
+// CHECK: define linkonce_odr x86_thiscallcc void @"\01??1Child@@QAE@XZ"
+// CHECK: call x86_thiscallcc void @"\01??1Base@@QAE@XZ"
+// CHECK: ret
+
+// Make sure that the Base destructor definition uses the right CC:
+// CHECK: define linkonce_odr x86_thiscallcc void @"\01??1Base@@QAE@XZ"
+
+// Make sure that the Base constructor definition uses the right CC:
+// CHECK: define linkonce_odr x86_thiscallcc void @"\01??0Base@@QAE@XZ"
+}
diff --git a/test/CodeGenCXX/microsoft-abi-static-initializers.cpp b/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
index 4ccd6ba..d8b7899 100644
--- a/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
+++ b/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
@@ -6,12 +6,12 @@ struct S {
 } s;
 
 // CHECK: define internal void [[INIT_s:@.*global_var.*]] nounwind
-// CHECK: call void @"\01??0S@@QAE@XZ"
+// CHECK: call x86_thiscallcc void @"\01??0S@@QAE@XZ"
 // CHECK: call i32 @atexit(void ()* @"__dtor_\01?s@@3US@@A")
 // CHECK: ret void
 
 // CHECK: define internal void @"__dtor_\01?s@@3US@@A"() nounwind {
-// CHECK: call void @"\01??1S@@QAE@XZ"
+// CHECK: call x86_thiscallcc void @"\01??1S@@QAE@XZ"
 // CHECK: ret void
 
 // Force WeakODRLinkage by using templates
@@ -34,16 +34,16 @@ void force_usage() {
 }
 
 // CHECK: define internal void [[INIT_foo:@.*global_var.*]] nounwind
-// CHECK: call void @"\01??0A@@QAE@XZ"
+// CHECK: call x86_thiscallcc void @"\01??0A@@QAE@XZ"
 // CHECK: call i32 @atexit(void ()* [[FOO_DTOR:@"__dtor_.*foo@.*]])
 // CHECK: ret void
 
-// CHECK: define linkonce_odr void @"\01??0A@@QAE@XZ"
+// CHECK: define linkonce_odr x86_thiscallcc void @"\01??0A@@QAE@XZ"
 
-// CHECK: define linkonce_odr void @"\01??1A@@QAE@XZ"
+// CHECK: define linkonce_odr x86_thiscallcc void @"\01??1A@@QAE@XZ"
 
 // CHECK: define internal void [[FOO_DTOR]]
-// CHECK: call void @"\01??1A@@QAE@XZ"{{.*}}foo
+// CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"{{.*}}foo
 // CHECK: ret void
 
 // CHECK: define internal void @_GLOBAL__I_a() nounwind {
