[No formal review is needed at this time]
- the inliner and -gvn were removing or ignoring calls to constructors that were prematurely treated as readonly when their arguments were writeonce.
- As result, calls like call void @_Z3bar1A(i32 %agg.tmp.sroa.0.0.copyload) were eventually replaced with call void @_Z3bar1A(i32 undef).
- This is not the case anymore.
This patch uses the @llvm.invariant.start/end intrinsics to either
- mark that writeonce memory locations have been written into and thus can now be treated as readonly, or
- mark that it's okay to write into a writeonce memory location again.
The markings are done as part of the -functionattrs pass for now.
Do not mark call arguments of non-pointer types readonly.
The associated call site may still be marked 'readonly'.