I noticed that rs4gc is not stripping a number of memory aliasing related attributes. We do strip some from call sites, but don't strip the same ones from declarations or parameters.
Why do we need to strip these? Two answers:
- Safepoints conceptually read and write to the entire garbage collected heap in the physical model. We need this to preserve ordering of all loads and stores with respect to possible relocation.
- We can infer other attributes from these. For instance, readnone can imply both nofree and nosync. Both of which don't hold after physical rewriting.
I'm mostly posting for review to give a chance for a sanity check, and a perf test if interested. I could see this negatively impacting optimization after lowering. I doubt it's a large effect, but that might be worth measuring.
It seems that leads to functional issue.
The problem here is that this function is invoked for any declared function in a module including llvm intrinsics which are not covered by statepoint instruction.
In my failed test it appeared llvm.x86.sse2.cvttsd2si64 and as a result readnone attribute has been cleared from it.
Later it could not find this intrinsic while linking:
Cannot select: intrinsic %llvm.x86.sse2.cvttsd2si64