[PATCH] D50654: [WebAssembly] Don't make wasm cleanuppads into funclet entries

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 13 14:46:58 PDT 2018


aheejin updated this revision to Diff 160453.
aheejin added a comment.

Remove a TODO line


Repository:
  rL LLVM

https://reviews.llvm.org/D50654

Files:
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  test/CodeGen/WebAssembly/exception.ll


Index: test/CodeGen/WebAssembly/exception.ll
===================================================================
--- test/CodeGen/WebAssembly/exception.ll
+++ test/CodeGen/WebAssembly/exception.ll
@@ -164,9 +164,8 @@
 ; CHECK:  try
 ; CHECK:  call      foo at FUNCTION
 ; CHECK:  catch_all
-; TODO These two should be removed too in a later patch
-; CHECK-NO T:  get_global  $push{{.+}}=, __stack_pointer at GLOBAL
-; CHECK-NO T:  set_global  __stack_pointer at GLOBAL, $pop{{.+}}
+; CHECK-NOT:  get_global  $push{{.+}}=, __stack_pointer at GLOBAL
+; CHECK-NOT:  set_global  __stack_pointer at GLOBAL, $pop{{.+}}
 ; CHECK:  call      __cxa_end_catch at FUNCTION
 ; CHECK-NOT:  set_global  __stack_pointer at GLOBAL, $pop{{.+}}
 ; CHECK:  end_try
Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1437,8 +1437,11 @@
   // Don't emit any special code for the cleanuppad instruction. It just marks
   // the start of an EH scope/funclet.
   FuncInfo.MBB->setIsEHScopeEntry();
-  FuncInfo.MBB->setIsEHFuncletEntry();
-  FuncInfo.MBB->setIsCleanupFuncletEntry();
+  auto Pers = classifyEHPersonality(FuncInfo.Fn->getPersonalityFn());
+  if (Pers != EHPersonality::Wasm_CXX) {
+    FuncInfo.MBB->setIsEHFuncletEntry();
+    FuncInfo.MBB->setIsCleanupFuncletEntry();
+  }
 }
 
 /// When an invoke or a cleanupret unwinds to the next EH pad, there are
@@ -1458,6 +1461,7 @@
     classifyEHPersonality(FuncInfo.Fn->getPersonalityFn());
   bool IsMSVCCXX = Personality == EHPersonality::MSVC_CXX;
   bool IsCoreCLR = Personality == EHPersonality::CoreCLR;
+  bool IsWasmCXX = Personality == EHPersonality::Wasm_CXX;
   bool IsSEH = isAsynchronousEHPersonality(Personality);
 
   while (EHPadBB) {
@@ -1472,7 +1476,8 @@
       // personalities.
       UnwindDests.emplace_back(FuncInfo.MBBMap[EHPadBB], Prob);
       UnwindDests.back().first->setIsEHScopeEntry();
-      UnwindDests.back().first->setIsEHFuncletEntry();
+      if (!IsWasmCXX)
+        UnwindDests.back().first->setIsEHFuncletEntry();
       break;
     } else if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(Pad)) {
       // Add the catchpad handlers to the possible destinations.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50654.160453.patch
Type: text/x-patch
Size: 2303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180813/6ed9fa88/attachment.bin>


More information about the llvm-commits mailing list