[cfe-dev] why does clang(llvm) do not optimize static throw/catch constructs?

Dennis Luehring dl.soluz at gmx.net
Tue Mar 17 21:44:06 PDT 2015


tested with http://gcc.godbolt.org/ x86 clang 3.7 (experimental)

this silly throw/catch construct isn't optmized down to return 1

isn't there any exception-flow analysis in clang/llvm (even detecting 
this stupid case)
or is there a C++ standard limitation that forbits such optimizations - 
or does it overall
not make sense trying to optimize try/catch-flow in any way

int main()
{
   try
   {
     throw 1;
   }
   catch(int e)
   {
     return e;
   }
   return 0;
}




More information about the cfe-dev mailing list