[PATCH] D15325: [WinEH] Update CoreCLR EH state numbering

Joseph Tremoulet via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 19:45:33 PST 2015


JosephTremoulet added inline comments.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:456
@@ +455,3 @@
+    } else if (auto *CSI = dyn_cast<CatchSwitchInst>(FirstNonPHI)) {
+      if (CSI->getUnwindDest())
+        // This will be visited from its unwind dest
----------------
JosephTremoulet wrote:
> andrew.w.kaylor wrote:
> > I'm probably not understanding this correctly.  Can you talk me through how a case like the following would be handled?
> > ```
> > try {
> >   try {
> >   } catch { // inner catch
> >   }
> > } catch { // outer catch
> >   try {
> >   } catch { // catch catch
> >   }
> > }
> > ```
> > If I have everything straight, both "outer catch" and "catch catch" will have null unwind destinations.  So that would make the parent state of "catch catch" -1, I think.  Is that what you want?
> > 
> Yes, that's what I want.  The relationship I need is:
>  - If a catchpad is not the first on its catchswitch, then the immediately prior catchpad on its same catchswitch is its parent
>  - otherwise, if **the try region for** EH pad A is the innermost try region enclosing **the try region for** EH pad B, then A is the parent of B
> 
> Since the try region for "outer catch" is disjoint with the try region for "catch catch", neither is an ancestor of the other; since no try region encloses the try region for "catch catch", its parent is -1.
Oops, got the first rule reversed.  It's:

 - If a catchpad is not the last on its catchswitch, then the immediately following catchpad on its same catchswitch is its parent
 - otherwise, if the try region for EH pad A is the innermost try region enclosing the try region for EH pad B, then A is the parent of B



http://reviews.llvm.org/D15325





More information about the llvm-commits mailing list