<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Shrink-wrapping clobbers live EFLAGS value"
   href="https://llvm.org/bugs/show_bug.cgi?id=27531">27531</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Shrink-wrapping clobbers live EFLAGS value
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, qcolombet@apple.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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@S@@QAEXXZ":                       # @"\01?foo@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@S@@QAEXPBHPAN@Z"
LBB0_4:                                 # %cleanup
        movl    %ebp, %esp
        popl    %ebp
        retl</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>