[llvm-bugs] [Bug 47531] New: __builtin_ia32_readeflags_u64() unnecessarily forces a frame pointer

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 14 15:03:34 PDT 2020


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

            Bug ID: 47531
           Summary: __builtin_ia32_readeflags_u64() unnecessarily forces a
                    frame pointer
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: luto at mit.edu
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

This code:

unsigned long read_eflags(void)
{
   return __builtin_ia32_readeflags_u64();
}

compiles to:

read_eflags:
        pushq   %rbp
        movq    %rsp, %rbp
        pushfq
        popq    %rax
        popq    %rbp
        retq

which has an unnecessary frame pointer.  (I'm somewhat puzzled as to why this
happened.  Sure, the redzone slot clobbered by the pushfq can't be used, but I
don't see what this has to do with a frame pointer.)

gcc generates:

read_eflags:
        pushfq
        popq    %rax
        ret

-- 
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/20200914/3148d19e/attachment.html>


More information about the llvm-bugs mailing list