[No formal review needed at this time.]
Diff Detail
Event Timeline
Bug Fix:
- 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 intrinsics are generated immediately after writing into a given address location, and, when applicable, at the end of a variable's lifetime.
Remove duplicate generation of invariant.start intrisic call for writeonce addresses.
Bug Fix: Global const object cases work again.
Solution: Teach BasicAA to not treat @llvm.invariant.start/end() intrinsic calls as potentially writing to memory.
Remove explicit 'writeonce' annotations; not worth the overhead of keeping them around (e.g. propagation through new AllocaInst's).
POC done (based on the sample programs in the design doc).
Moving towards initial patch submission for review:
- Fix unexpected failures in regression tests: 8
- generalize and add new test cases.
FYI, if this is something you'd like to start more active code review on, I
would recommend closing this particular entry on Phabricator and creating a
new one with llvm-commits subscribed from the start. Adding a mailing list
doesn't work well with Phabricator sadly. =/ It will also give a good
chance to update the description because I know you've made a lot of
progress based on the design review, etc.
Update diff with more visible context (-U999999).
[ * This was submitted in error -- Please ignore this diff *]