This updates checkFunctionMemoryAccess() to infer a precise FunctionModRefBehavior, rather than an approximation split into read/write and argmemonly.
Afterwards, we still map this back to imprecise function attributes. This still allows us to infer some cases that we previously did not handle, namely inaccessiblememonly and inaccessiblemem_or_argmemonly. In practice, this means we get better memory attributes in the presence of intrinsics like @llvm.assume.
The claim that no instruction other than a call can access inaccessiblememory seems reasonable on the surface, but is a somewhat significant change. The corner cases would be something like maybe an indirect br.
If possible, could you separate this into it's own commit for risk reduction? Having something easy to revert could be helpful.