https://llvm.org/bugs/show_bug.cgi?id=26305

            Bug ID: 26305
           Summary: [X86] Failing to tail call with bool parameter
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedb...@nondot.org
          Reporter: h...@chromium.org
                CC: llvm-bugs@lists.llvm.org
            Blocks: 26299
    Classification: Unclassified

Consider:

  void f(bool);
  void g(bool x) {
    f(x);
  }

Clang will generate:

00000000 <_Z1gb>:
   0:    83 ec 0c                 sub    $0xc,%esp
   3:    0f b6 44 24 10           movzbl 0x10(%esp),%eax
   8:    89 04 24                 mov    %eax,(%esp)
   b:    e8 fc ff ff ff           call   c <_Z1gb+0xc>
  10:    83 c4 0c                 add    $0xc,%esp
  13:    c3                       ret


GCC 5.3 will do the tail call, but still insists on zexting:

g(bool):
        movzbl  4(%esp), %eax
        movl    %eax, 4(%esp)
        jmp     f(bool)

MSVC hits the spot and emits a single jmp:

?g@@YAX_N@Z (void __cdecl g(bool)):
  00000000: E9 00 00 00 00     jmp         ?f@@YAX_N@Z

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to