[llvm-bugs] [Bug 27531] New: Shrink-wrapping clobbers live EFLAGS value

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 26 15:52:19 PDT 2016


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

            Bug ID: 27531
           Summary: Shrink-wrapping clobbers live EFLAGS value
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvm-bugs at lists.llvm.org, qcolombet at apple.com
    Classification: Unclassified

a.cc:

  struct S {
    void foo();
    void bar(const int*, double*);
    int x_;
  };

  void S::foo() {
    int data[] = { x_ > 32 ? 42 : 128 };

    if (x_ <= 31)
      return;

    double d;
    bar(data, &d);
  }

Compiled like this:

$ bin/clang -target i686-pc-win32 -Os -S -o - /tmp/a.cc -march=i686

Yields the following output:

"?foo at S@@QAEXXZ":                       # @"\01?foo at S@@QAEXXZ"
# BB#0:                                 # %entry
        cmpl    $32, (%ecx)
        movl    $42, %eax
        jg      LBB0_2       <---- Sets EFLAGS
# BB#1:                                 # %entry
        movl    $128, %eax
LBB0_2:                                 # %entry
        pushl   %ebp
        movl    %esp, %ebp
        andl    $-8, %esp    <---- Clobbers EFLAGS
        leal    -16(%esp), %esp
        movl    %eax, 4(%esp)
        jl      LBB0_4       <---- Was depending on EFLAGS
# BB#3:                                 # %if.end
        leal    8(%esp), %eax
        leal    4(%esp), %edx
        pushl   %eax
        pushl   %edx
        calll   "?bar at S@@QAEXPBHPAN at Z"
LBB0_4:                                 # %cleanup
        movl    %ebp, %esp
        popl    %ebp
        retl

-- 
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/20160426/aea70c35/attachment.html>


More information about the llvm-bugs mailing list