[LLVMdev] RFC: Exception Handling Proposal Revised

Duncan Sands baldrick at free.fr
Tue Dec 7 12:30:33 PST 2010


Hi Bill, there are a couple of things I didn't understand about your proposal,
for example how it interacts with inlining, whether it is feasible to do the
"turn invoke-of-Unwind_Resume into a branch" optimization and also whether in
"resumedest" you still plan to use _Unwind_Resume to continue unwinding up the
stack.  Could you please show what the LLVM IR would look like for the following
example both before and after inlining, and if the optimization I mentioned is
compatible with the dispatch instruction can you please show how the IR would
look after it is applied (right now it has the nasty habit of leaving calls to
eh.selector far away from any landing pad, and I'm worried it might leave stray
dispatch instructions in odd places, breaking the rules about where they may be
placed).

Thanks a lot, Duncan.

#include <stdio.h>

struct X { ~X() { printf("Running destructor!\n"); } };

void foo() {
   struct X x;
   throw 1;
}

int main() {
   try {
     foo();
   } catch (int) {
     printf("Caught exception!\n");
   }
   return 0;
}



More information about the llvm-dev mailing list