[PATCH] D15478: [MS ABI] Don't rely on terminatepad

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 14 10:37:30 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL255521: [MS ABI] Don't rely on terminatepad (authored by majnemer).

Changed prior to commit:
  http://reviews.llvm.org/D15478?vs=42641&id=42736#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15478

Files:
  cfe/trunk/lib/CodeGen/CGException.cpp
  cfe/trunk/test/CodeGenCXX/exceptions-cxx-new.cpp
  cfe/trunk/test/CodeGenCXX/microsoft-abi-eh-terminate.cpp

Index: cfe/trunk/test/CodeGenCXX/exceptions-cxx-new.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/exceptions-cxx-new.cpp
+++ cfe/trunk/test/CodeGenCXX/exceptions-cxx-new.cpp
@@ -72,5 +72,6 @@
 // CHECK:   ret void
 
 // CHECK: [[TERMINATE]]
-// CHECK:   terminatepad within none [void ()* @"\01?terminate@@YAXXZ"] unwind to caller
+// CHECK:   cleanuppad within none []
+// CHECK-NEXT:   call void @"\01?terminate@@YAXXZ"()
 
Index: cfe/trunk/test/CodeGenCXX/microsoft-abi-eh-terminate.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-eh-terminate.cpp
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-eh-terminate.cpp
@@ -9,6 +9,7 @@
 // CHECK-LABEL: define void @"\01?never_throws@@YAXXZ"()
 // CHECK-SAME:          personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
 // CHECK:      invoke void @"\01?may_throw@@YAXXZ"()
-// MSVC2013:      terminatepad within none [void ()* @"\01?terminate@@YAXXZ"]
-// MSVC2015:      terminatepad within none [void ()* @__std_terminate]
+// CHECK:      cleanuppad within none []
+// MSVC2013:      call void @"\01?terminate@@YAXXZ"()
+// MSVC2015:      call void @__std_terminate()
 // CHECK-NEXT: unreachable
Index: cfe/trunk/lib/CodeGen/CGException.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp
+++ cfe/trunk/lib/CodeGen/CGException.cpp
@@ -1325,21 +1325,20 @@
   // end of the function by FinishFunction.
   TerminateHandler = createBasicBlock("terminate.handler");
   Builder.SetInsertPoint(TerminateHandler);
+  llvm::Value *Exn = nullptr;
   if (EHPersonality::get(*this).usesFuncletPads()) {
     llvm::Value *ParentPad = CurrentFuncletPad;
     if (!ParentPad)
       ParentPad = llvm::ConstantTokenNone::get(CGM.getLLVMContext());
-    Builder.CreateTerminatePad(ParentPad, /*UnwindBB=*/nullptr,
-                               {CGM.getTerminateFn()});
+    Builder.CreateCleanupPad(ParentPad);
   } else {
-    llvm::Value *Exn = nullptr;
     if (getLangOpts().CPlusPlus)
       Exn = getExceptionFromSlot();
-    llvm::CallInst *terminateCall =
-        CGM.getCXXABI().emitTerminateForUnexpectedException(*this, Exn);
-    terminateCall->setDoesNotReturn();
-    Builder.CreateUnreachable();
   }
+  llvm::CallInst *terminateCall =
+      CGM.getCXXABI().emitTerminateForUnexpectedException(*this, Exn);
+  terminateCall->setDoesNotReturn();
+  Builder.CreateUnreachable();
 
   // Restore the saved insertion state.
   Builder.restoreIP(SavedIP);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15478.42736.patch
Type: text/x-patch
Size: 2596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151214/341fcf17/attachment.bin>


More information about the cfe-commits mailing list