willreturn is now required by a number of passes in order to remove
function calls. Currently we fail to eliminate readonly function calls
in mustprogress functions, because we do not combine the mustprogress
info of the containing function with the readonly info at call sites.
This can lead to situations where calls that are guaranteed to return
are not eliminated from C++ code, as discussed on llvm-dev.
This patch updates FunctionAttrs to add willreturn to readonly call
sites in mustprogress functions or willreturn function. This also allows
adding willreturn to the containing function, if all function calls can
be marked as willreturn.
Markgin callsites in a willreturn function as willreturn, can also be
helpful in the presence of inlining. There is a potentialcyclic dependency
between adding willreturn to functions and callsites in a function:
adding willreturn to callsites first enables adding willreturn to the
function in some cases. But adding willreturn to a function first
enables adding willreturn to more callsites.
For now, add it to callsites first.