Register allocator performing worse in avr-gcc-5.x?

Thilo Schulz <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <6253197.bG5ibaNIF8@helmuth>
Hello,

there's one thing I have noticed when compiling with avr-gcc-5.2.0, and it is
that compared to avr-gcc.4.8.1, it generates larger binaries and optimizes
worse, while using identical compilation flags, especially when under high
register pressure.

Case in point:
http://thilo.tjps.eu/avrtest.c
This is an excerpt from one of my programs designed the show the
different behaviour.

Compile with:
avr-gcc-5.2.0 -ggdb3 -Wall -Wno-volatile-register-var -mmcu=attiny13a -Os -o test.o -c test.c
avr-gcc-4.8.1 -ggdb3 -Wall -Wno-volatile-register-var -mmcu=attiny13a -Os -o test.o -c test.c

The 5.2.0 version spills many registers, while the 4.8.1 has no
need to do so. I'd appreciate if you could have a look into this.

About the "volatile" keyword in front of the global register variable:
Feel free to try what happens when you remove this keyword. That in itself
is interesting, and this behaviour is exhibited by both compiler versions.

-- 
Best regards,
Thilo Schulz
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.