arm compiler benchmarks


I didn’t do any serious benchmarking but so far I never found a case where LLVM does better than IAR on CortexM0, but I saw a lot of cases where IAR output is better than LLVM…

That said I did not use -Os or -Oz, I just used -O3.

A recurrent situation is that LLVM push/pop one or two extra registers compared to IAR, I guess it does so in order to comply with a standard ABI or something but in the world of deeply embedded system, we don’t care of such things 99.99% of the time…

If you want to see some good code output, take a look at IAR, there is a free version limited in code size online.



Cortex-M0 is a Thumb1 only device. There hasn’t been any concerted effort to tune LLVM’s Thumb1 output in quite a long time. Even back then (2008 or so), the effort was mainly to get it to work acceptably, with the real performance tuning work being done for Thumb2. I’m not surprised that an embedded market focussed compiler like IAR is better tuned for a chip like that.


What about benchmarks on other Arm devices?

I’ve not run any on non-iOS devices, and haven’t looked at GCC since v4.2.1 due to licensing issues, so I don’t have a good feel for comparative benchmarking.


I haven’t tried using -Os/z on any ARM device for the last 3 years, and back then, -Os would break many things.

People normally care about code size on Cortex-R/M and ARM9 or older, and in there, not many LLVM users.


There are a lot of A8 devices around with 256KB (or less) of L2 cache (32KB of L1 i-cache), and so code density, if not code size, matters a lot for these. Cache sizes in mobile chips tend to be as small as possible, as it's very hard to turn off those transistors (there are several projects at ARM and elsewhere that I'm aware of in this direction, but I don't know of any in shipping products yet).


I didn't mean to say that code size is not important, especially for ARM,
just that the average LLVM user (even ARM users) will not care yet that

Most benchmarks I've seen around are all platform software, comparing
performance with Atom and not a single mention on code size. When I did
some benchmarks a few years back, I noticed that LLVM's code was at least
twice as big as GCC with the same specs, some times more than 4x bigger,
would be good to know how it compares now to see how much people really
care about code size.


Will you be able to share your results? I think you'll find that LLVM has
indeed progressed in that area, as I've seen some commits going through
during the last few years on that area. I'd like to know if we're getting
close to GCC.


I will surely share some results when I have them.

I'm working on mips 16 which is like thumb 1.

For mips 16 people only care about size usually.

I need to implement a simple version of constant islands which I hope to finish this week and then I should have the tools to start to be competitive.


So I guess it's on the same level as the M0, makes sense worry more about
code size than optimization levels.