NPM and code-size

(NPM: new pass manager; LPM: legacy pass manager)

In a first quick experiment today I compared code-size of the LMP vs. the NMP for the CSiBE benchmark (and some other), and this shows code-size increases with the NPM that would probably be unacceptable for us. So, now I am wondering how/if we need to mitigate this, and have a bunch of questions.

As I’ve noticed quite some activity around the NPM recently, I am first of all curious if there’s an idea or estimate when the NPM will be enabled? And sorry if I missed this. That would give us an idea how much time we have to tune the NMP and the pipeline for code-size, which I think would be the obvious mitigation. Other questions would be if the NPM is mostly tuned for performance at the moment, if others have observed code-size increases too, and if flipping the switch from the LPM to NPM would be for all optimisation levels at the same time, or if we e.g. will fall back to the old one for some?

Thanks,
Sjoerd.

There’s no official timeline for switching to the NPM, but I am trying to get it ready ASAP.
What flags are you using for code size? I’m not familiar with the internals of the NPM optimization passes especially in regards to code size, adding some people who may be more familiar.

Extracting some test cases to demonstrate the issue would be helpful for triaging purposes.

David

Thanks for your replies.
As I wrote in the other thread today, I need a little bit of time to get up to speed here. I.e. need to start collecting more benchmark data, and start doing some analysis which I haven’t done yet. I think the code-size problems will be visible with just -Oz, that’s essentially the only flag I used for CSiBE. But I will first start collecting some data on the llvm test-suite (and also for -Os), that’s probably best for the discussion here upstream, to confirm that shows the same trend as on our (downstream / other) benchmarks.

Just to give an early impression, I have copied numbers for CSiBE below. The second column shows the number of bytes for the different apps using the LPM, the third column using the NPM, an the fourth column is the percentage difference. This shows there one improvement, bzip2, and all the others have regressed significantly for code-size standards.

 app                        LPM        NPM         Diff 
 csibe/OpenTCP-1.0.4        21399      21603       0.95%
 csibe/bzip2-1.0.2          48144      47956      -0.39%
 csibe/cg_compiler_opensrc  96007      96511       0.52%
 csibe/compiler             19358      19464       0.55%
 csibe/jikespg-1.3          171786     175040      1.89%
 csibe/jpeg-6b              94953      97341       2.51%
 csibe/libpng-1.2.5         78085      79097       1.29%
 csibe/lwip-0.5.3.preproc   68243      68525       0.41%
 csibe/mpeg2dec-0.3.1       37266      37402       0.36%
 csibe/mpgcut-1.1           7480       7620        1.87%
 csibe/teem-1.6.0-src       1089031    1093291     0.39%
 csibe/ttt-0.10.1.preproc   12679      13035       2.81%
 csibe/unrarlib-0.4.0       10160      10304       1.42%
 csibe/zlib-1.1.4           29003      29375       1.28% csibe                      1783594    1796564     0.73%