[llvm-bugs] [Bug 26305] New: [X86] Failing to tail call with bool parameter

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 25 16:25:43 PST 2016


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: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvm-bugs at 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 at Z (void __cdecl g(bool)):
  00000000: E9 00 00 00 00     jmp         ?f@@YAX_N at Z 

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160126/66ff51ca/attachment.html>


More information about the llvm-bugs mailing list