I don’t think that “contextual optimization” is a definite term, but I think that it basically means that the compiler can analyze the call site and the code around it and use this information to optimize the function.
. , , :
:
int foo(int i)
{
if (i < 0) throw std::invalid_argument("");
return -i;
}
:
int bar()
{
int i = 5;
return foo(i);
}
foo , . bar, :
int bar()
{
int i = 5;
if (i < 0) throw std::invalid_argument("");
return -i;
}
int bar()
{
return -5;
}