[PATCH] D42092: implement C++ dr388 for the Itanium C++ ABI: proper handling of catching exceptions by reference

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 21:59:41 PST 2018


rsmith added inline comments.


================
Comment at: lib/CodeGen/ItaniumCXXABI.cpp:3878
+      } else {
+        // FIXME: We could filter out definitely-unreachable catch handlers.
+        EHCatchScope *LaterCatchScope =
----------------
There are a lot of other optimizations possible here. For example: if there are no later catches, and no enclosing EH scopes, we can just `resume` (before the `__cxa_begin_catch`) call. Or if the first such later catch will definitely catch the exception (eg, `catch (int*&) {} catch (int*) {}`), we could branch directly to it.

I'm inclined to think we should keep the frontend emission simpler and implement these cases as EHABI-aware middle-end optimization passes if we care enough about them.


Repository:
  rC Clang

https://reviews.llvm.org/D42092





More information about the cfe-commits mailing list