GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/avr

Make AVR `casesi` pass controllable via new command-line option.

AVR `casesi` pass can now be controlled with the new `-mdemote-switch` option.

The AVR-specific avr_pass_casesi optimization pass is now controlled by a new command-line option, -mdemote-switch. This option is enabled by default when optimizations are active, mirroring the previous behavior of the pass’s gate function. This change provides explicit control over the casesi pass for AVR targets.

In Details

The avr_pass_casesi pass, responsible for optimizing switch statements on AVR targets, previously had its gate controlled implicitly. This commit introduces a new option, -mdemote-switch, to explicitly enable or disable this pass. The option is set in avr-common.cc and checked in avr_pass_casesi::gate in avr-passes.cc, ensuring that its behavior aligns with the previous implicit gating, controlled by avropt_demote_switch.

For Context
AVR
A family of microcontrollers developed by Atmel (now Microchip Technology).
pass
A distinct phase or transformation within the compiler that operates on the program's intermediate representation.
switch statement
A control flow statement that allows a value to be tested for equality against a list of values and to execute code based on the match.
gate function
A function within a compiler pass that determines whether the pass should be executed for a given function or code block, often based on optimization levels or specific target features.
Filed Under: avroptimizationcompiler pass