[PATCH] D15139: [IR] Reformulate LLVM's EH funclet IR

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 11:08:31 PST 2015


rnk added inline comments.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:180-184
@@ +179,7 @@
+    int BaseState = -1;
+    if (FuncletUnwindDest == InvokeUnwindDest) {
+      auto BaseStateI = FuncInfo.FuncletBaseStateMap.find(FuncletPad);
+      if (BaseStateI != FuncInfo.FuncletBaseStateMap.end())
+        BaseState = BaseStateI->second;
+    }
+
----------------
It sounds like it's OK if C++ and the CLR number these slightly differently:
  void f() {
    try {
      g(0); // state 0
      try {
        g(1); // state 1
      } catch( ...) {
        // C++ needs to be in TryHigh+1 to CatchHigh interval
        g(2); // CLR state 0, C++ state 2
      }
    } catch(...) {
    }
  }

You actually want to assign the outer state of 0 to the g(2) call site, and the table emitter will do the work of emitting duplicate clauses on the handler.

In that case, I think you can avoid filling in FuncletBaseStateMap, always use BaseState = NullState, and things will work.


http://reviews.llvm.org/D15139





More information about the llvm-commits mailing list