It is common in C++ code to end up with an invoke whose unwind destination just does the C++ equivalent of an unwind. This should be turned into a call, saving on code size and speeding up unwinding. For example, here is a testcase: #include <string> int f() { std::string s("hola"); return s.length(); } This compiles to: ... invoke void @_ZNSsC1EPKcRKSaIcE(...) to label %bb69 unwind label %lpad ... %tmp116 = invoke i32 @_ZN9__gnu_cxx18__exchange_and_addEPVii( i32* %tmp114, i32 -1 ) to label %invcont115 unwind label %lpad148 ... pad: ; preds = %entry %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] %eh_select147 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null ) br label %Unwind lpad148: ; preds = %bb111 %eh_ptr149 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] %eh_select151 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr149, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null ) br label %Unwind Unwind: ; preds = %lpad148, %lpad %eh_exception.0 = phi i8* [ %eh_ptr, %lpad ], [ %eh_ptr149, %lpad148 ] call i32 (...)* @_Unwind_Resume_or_Rethrow( i8* %eh_exception.0 ) unreachable Both of these invokes can be turned into (throwing) call instructions, saving code size and reducing compile time. -Chris
This works correctly now.