So I have a couple of question regarding the approach provided by Chill.
- How to prevent such memory re-reads in the future? Is there any BKM (best known method) for programming guidelines which could eliminate or reduce those re-reads?
- What could be the downside of the flag -Xclang -new-struct-path-tbaa? Why not using it by default if it makes better aliasing analysis?
I don’t think there’s any particular set of recommendations for this specific missed optimization/issue - are you working in an environment where memory reads are exceptionally expensive (in comparison to all the other things that a compiler might optimize code for & might not do so perfectly (no compiler’s perfect, even within the bounds of the language and non-standard extensions))? I think this falls under the general bucket of “write code” → “optimize code”. Use profilers, find the hot spots, look at the code to see if you can make it algorithmically better, look at the machine code if it comes to that & see if you can tweak the source to get the assembly you want, or hand-write portions, etc.
- I’m guessing it’s work-in-progress and might not be production-ready/tested yet
On Tue, Oct 29, 2019 at 10:57 AM אלכס לופ’ <email@example.com> wrote:
Answering the second question, the new TBAA representation is a work in progress; it’s not mature enough to be enabled by default.