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

            Bug ID: 94934
           Summary: Failure to inline addv
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int f(int x, int y)
{
    return x + y;
}

With -O3 -ftrapv, LLVM outputs this :

f(int, int): # @f(int, int)
  mov eax, edi
  add eax, esi
  jo .LBB0_1
  ret
.LBB0_1:
  ud2

GCC outputs this :

f(int, int):
  sub rsp, 8
  call __addvsi3
  add rsp, 8
  ret

`-ftrapv` may not be specifically intended for speed, but it seems to make
sense to inline it on targets that have direct support for the instructions it
uses.

Reply via email to