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: unassignedb...@nondot.org
          Reporter: konstantin.belocha...@sony.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to