You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
int f() {
std::string s("hola");
return s.length();
}
llvm#1450 and llvm#2205 as complete; they are just wording changes in the standard. Mark issues llvm#2359, llvm#2320 and llvm#2322 as complete - libc++ implements them already.
llvm-svn: 202671
Extended Description
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
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
The text was updated successfully, but these errors were encountered: