[llvm-bugs] [Bug 36042] New: [PCG] Redundant stack operations

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 22 13:13:54 PST 2018


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

            Bug ID: 36042
           Summary: [PCG] Redundant stack operations
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: konstantin.belochapka at sony.com
                CC: llvm-bugs at lists.llvm.org

Redundant stack operations from clang.
A repro case with command line and disassembly is below.

Source (test.c):
typedef bool (*CallbackFunc)(unsigned int param);
bool Test(CallbackFunc func, unsigned int param)
{
  bool x = func(param);
  return (x || 1);
}

Command Line:
clang -fomit-frame-pointer -O2 -g -c test.c test.o

Disassembly:
Test:                                   # @Test
    .cfi_startproc
# BB#0:                                 # %entry
    pushq    %rax
.Ltmp1:
    .cfi_def_cfa_offset 16
    movq    %rdi, %rax
    movl    %esi, %edi
    callq    *%rax
    movb    $1, %al
    popq    %rdx
    ret

Notice the redundant 'push rax' (and the 'pop rdx' that seems to go with it).
Please note that the -fomit-frame-pointer is intentional in this
case, btw.. even though it's not actually a leaf function.

-- 
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/20180122/92dc817f/attachment.html>


More information about the llvm-bugs mailing list