================
@@ -341,9 +341,11 @@ void llvm::calculateSEHStateForAsynchEH(const BasicBlock 
*BB, int State,
         // Retrive the new State from seh_try_begin
         State = EHInfo.InvokeStateMap[cast<InvokeInst>(TI)];
       else if (Fn && Fn->isIntrinsic() &&
-               Fn->getIntrinsicID() == Intrinsic::seh_try_end)
+               Fn->getIntrinsicID() == Intrinsic::seh_try_end) {
----------------
MuellerMP wrote:

This reuses the invoke state map for try.end in a fashion already available for 
the cxx state numbering algorithm.
It allows to terminate multiple SEH scopes at once without needing an 
additional cleanup scopes per nested try.
It works by looking up the state for the matching unwind destination and then 
decrements the state number (which is expressed by the ToState assignment).

I added a nested try catch test which showcases this (without this patch we 
will end up in `Exit` instead of having the exception propagate to the caller).

https://github.com/llvm/llvm-project/pull/167176
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to