We can sometimes propegate `nocapture` attributes from caller
arguments to callsite arguments.
This can occur in in the following cases:
1) The callsite is in a basic block that ends with a return statement.
2) Between the callsite the end of its basic block there are no
3) The return value of the callsite is not used (directly or indirectly)
as the address of a may-read instruction.
4) There are allocas or leaked (not freed or returned) mallocs reachable
from the callsite.
These requirements are intentionally over conservative. We are only trying
to catch relatively trivial cases.
Requirements 1 & 2 are there to ensure that after the callsite has
returned, the state of any captured in memory pointers cannot change. This
implies that if the caller has any nocapture in memory gurantees, that
state has been reached by the end of the callsite.
Requirements 3 & 4 are to cover cases where pointers could escape the
callsite (but not the caller) through non-dead code. Any return value thats
loaded from (or used to create a pointer that is loaded from) could have
derived from an argument. Finally, allocas/leaked mallocs in general are
difficult (so we avoid them entirely). Callsites can arbitrarily store
pointers in allocas for use later without violating a nocapture gurantee by
the caller, as the allocas are torn down at caller return. Likewise a
leaked malloc would not be accessible outside of the caller, but could
still be accessible after the callsite. There are a variety of complex
cases involving allocas/leaked mallocs. For simplicity, if we see either we