Reducing code size with LLVM Machine Outliner on 32-bit Arm targets
linaro.org
linaro.org
I suppose tracing is a bit like this, but I've only seen that done dynamically.
From a performance perspective, I was wondering how this would interact with inlining, as there is the potential to inline and then extract more generalised call sequences and hence get better performance without the memory bloat from inlining. Definitely sounds like an interesting option.
I replied to the speed question in a previous comment, but can put it here as well, I don't have exact numbers to report but on average you can expect a regression around 2%, but it will depend of call latency of the core and is also impacted by cache effects, so in some cases you can have a performance improvement
The fact that so many other architectures enable it seem to hint that it would likely pay off for arm-32 too.
"Machine Outliner" maybe somewhat more descriptive, but I think calling it "LLVM-LZ" might be more catchy and memorable.
b OUTLINED_FUNCTION_0
jumps can be removed (in the code as presented, the last one. A sufficiently smart compiler would figure out which of the functions is called most often). If the outliner pass doesn’t do that, is there a LLVM pass that can do that kind of stuff?To give more details on the LLVM optimization pipeline there are only two passes which run after the Machine Outliner for ARM before code emission (ConstantIslands and LowOverheadLoops) because they are dependent upon block layout and size.
If it's hot, it's a bit slower, because you have the added fn call overhead. So better do that manually.