In these compilers, the use of the -O (or potentially -O2, -Os, -Oz, or others, depending on use-case) compile option can be used to collapse identical switch statements.
-O
-O2
-Os
-Oz