[AArch64][GlobalISel] Move the localizer to run before the legalizer, and always localize globals.
Our strategy for localizing globals in the entry block breaks down when we have large functions with high register pressure, using lots of globals. When this happens, our heuristics say that globals with many uses should not be localized, leading us to cause excessive spills and stack usage. These situations are also exacerbated by LTO which tends to generate large functions. For now, moving to a strategy that's simpler and more akin to SelectionDAG fixes these issues and makes our codegen more similar. This has an overall neutral effect on size on CTMark, while showing slight improvements with -Os -flto on benchmarks. For low level firmware software though we see big improvements. The reason this is neutral, and not an improvement, is because we give up the gains from CSE'ing globals in cases where we low register pressure. I think this can be addressed in future with some better heuristics. Differential Revision: https://reviews.llvm.org/D147484
Loading
Please sign in to comment