<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Thanks. That helped a lot. I ended up using your cascading "returns" idea with a state variable per try/catch. (should anyone ever need this in the future), where I do something like state = 1; goto end_of_catch; end_of_catch catch ret to a jumping pad that jumped to the next location, recursively.<br></div><div><br></div><div>On Mon, Oct 11, 2021, at 21:36, Reid Kleckner wrote:<br></div><blockquote type="cite" id="qt" style=""><div dir="ltr"><div>I think LLVM supports multiple catchrets, so that should work as long as they both return to the same parent function/funclet.<br></div><div><br></div><div><div>However, if you need to branch through multiple levels, you will probably have to set up an alloca used by a branch at the point of the return. This is what that would look like:<br></div><div><br></div><div>void f() {<br></div><div>  try { maythrow(); }<br></div><div>  catch (...) {<br></div><div>    try { maythrow(); }<br></div><div>    catch (...) {<br></div><div>      if (condition()) goto out; // need to thread the target through the cascading returns<br></div><div>      stuff();<br></div><div>    } // IR needs branch here<br></div><div>    stuff();<br></div><div>  } // IR needs branch here<br></div><div>  return 0;<br></div><div>out:<br></div><div>  return 1;<br></div><div>}<br></div></div><div><br></div><div>HTH<br></div></div><div><br></div><div class="qt-gmail_quote"><div dir="ltr" class="qt-gmail_attr">On Fri, Oct 8, 2021 at 12:45 PM Carlo Kok via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="qt-gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;"><div>If I need to branch out of the catch (catchpad) can I use a conditional catchret (ie have a catch with multiple catchret's) or do I have to branch to the end of the catch, and branch out from after the catchpad point?<br></div><div> <br></div><div> --<br></div><div> Carlo Kok<br></div><div> _______________________________________________<br></div><div> LLVM Developers mailing list<br></div><div> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br></div><div> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></div></blockquote></div></blockquote><div><br></div></body></html>