https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40748

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #3)
> We also miss the even simpler case that should be optimized to "return n;"
> 
> int foo(int n){
>     switch(n){
>         case 0:
>             return 0;
>         case 1:
>             return 1;
>         case 2:
>             return 2;
>         case 3:
>             return 3;
>         default:
>             __builtin_unreachable();
>     }
> }
> 
> llvm performs the expected optimization in both cases.

Note this one is implemented since 9.1.0.

Reply via email to