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

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 14:51:12 PST 2015


andrew.w.kaylor added inline comments.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:450
@@ +449,3 @@
+  // when really what it proved is that the catchswitch never takes its unwind
+  // edge (e.g. SimplifyUnreachable).  If we hit that case here, we will end up
+  // reporting such a catchswitch as top-level -- i.e. not inside any protected
----------------
JosephTremoulet wrote:
> andrew.w.kaylor wrote:
> > This comment makes me nervous.  Besides indicating where exceptions that occur inside the catchpads unwind the unwind clause of a catchswitch also indicates where an exception will go if it is not caught by any of the handlers in the catchswitch.  So in order to change this clause from some EH pad to "unwinds to caller" we'd need to know both that none of the catch pads ever throws an exception and that all exceptions that come to this catch switch are caught by one of the catch pads (and even then, it seems like a bad idea).  It doesn't seem like any optimization outside of the WinEH-specific handling should be able to confirm this second condition since it depends on the personality function.  Is this really happening?
> The only place I'm aware of making this transformation is in SimplifyCFG's SimplifyUnreachable -- if the catchswitch (and invokes etc within the catches) unwinds to a cleanuppad that immediately its `unreachable`, we'll `removeUnwindEdge` each of those preds -- so in that case,
>  a) the inference is coming from the unwind destination, not analysis of the switch clauses, and
>  b) the same transformation will get applied to the invokes and such in the catches
> which may be of some comfort.
> 
> Point well taken that preserving the agreement between unwind destinations in catches w.r.t. each other and the catchswitch in general requires careful non-local analysis.
OK. I got the impression from this comment that this was happening if nothing was unwinding from within the catch switch.


http://reviews.llvm.org/D15325





More information about the llvm-commits mailing list