[llvm-dev] Where's the optimiser gone? Or: who reviews the code you ship?

Stefan Kanthak via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 4 03:30:57 PDT 2020


Hi @ll,

who can tell me (or the world) why an optimising compiler emits the
code sequence shown in the left column (found 4x in the "builtins"
library)?
In the middle column the expected code sequence.

    mov    eax, 0         #     xor   eax, eax         # -3 bytes
    cmp    ecx, edx       #     cmp   edx, ecx
    jb     @f             #     ja    @f
    cmp    edx, ecx       #                            # -2 bytes
    mov    eax, 1         #                            # -5 bytes
    adc    eax, 0         #     adc   eax, 1           # -2 insns
@@:                       # @@:
    ret                   #     ret

Stefan
-- 
<https://www.duden.de/rechtschreibung/Kanthaken>


More information about the llvm-dev mailing list