[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

David Majnemer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 16 15:20:12 PDT 2018


majnemer added inline comments.


================
Comment at: lib/CodeGen/CGException.cpp:1164
+      CurrentFuncletPad);
+  llvm::BasicBlock *CatchStartBlock = nullptr;
+  if (EHPersonality::get(*this).isWasmPersonality()) {
----------------
Maybe this should be called WasmCatchStartBlock?


================
Comment at: lib/CodeGen/CGException.cpp:1173
+        cast<llvm::CatchPadInst>(CatchStartBlock->getFirstNonPHI());
+    CurrentFuncletPad = CPI;
+  }
----------------
Hmm, why is this done? Won't RestoreCurrentFuncletPad undo this?


================
Comment at: lib/CodeGen/CGException.cpp:1241-1245
+    while (llvm::TerminatorInst *TI = RethrowBlock->getTerminator()) {
+      llvm::BranchInst *BI = cast<llvm::BranchInst>(TI);
+      assert(BI->isConditional());
+      RethrowBlock = BI->getSuccessor(1);
+    }
----------------
This seems pretty fragile, why is this guaranteed to work? Could we maintain a map from CatchSwitchInst to catch-all block?


Repository:
  rC Clang

https://reviews.llvm.org/D44931





More information about the cfe-commits mailing list