<html>
    <head>
      <base href="http://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 --- - Self hosting broken with -enable-aa-sched-mi"
   href="http://llvm.org/bugs/show_bug.cgi?id=18497">18497</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Self hosting broken with -enable-aa-sched-mi
          </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>hfinkel@anl.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11877" name="attach_11877" title="The miscompiled function">attachment 11877</a> <a href="attachment.cgi?id=11877&action=edit" title="The miscompiled function">[details]</a></span>
The miscompiled function

Self hosting is currently broken when the -enable-aa-sched-mi feature is used.
This is true on both x86_64 and PPC64 (at least).

Here I've isolated one particular problem spot (using r198803 on x86_64): The
function _ZN4llvm16DAGTypeLegalizer18WidenVecRes_BinaryEPNS_6SDNodeE in
lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp is being miscompiled. I've
extracted that function in the attached file.

More specifically:

llc -enable-misched -misched-bottomup=0 -misched-topdown=0 -misched=shuffle
-enable-aa-sched-mi -misched-only-block=6 -misched-cutoff=7

Will give correct code, while:

llc -enable-misched -misched-bottomup=0 -misched-topdown=0 -misched=shuffle
-enable-aa-sched-mi -misched-only-block=6 -misched-cutoff=8

will give incorrect code.

The difference in output is:

--- /tmp/good_func.s    2014-01-15 18:48:27.254951945 -0600
+++ /tmp/bad_func.s     2014-01-15 18:48:35.335177403 -0600
@@ -59,15 +59,15 @@
        cmpw    $0, 56(%rbx)
        je      .LBB0_9
 # BB#3:                                 # %_ZNK4llvm6SDNode10getOperandEj.exit
-       movl    88(%rsp), %r12d
-       movq    96(%rsp), %rax
-       movq    %rax, 40(%rsp)          # 8-byte Spill
+       movq    96(%rsp), %r12
        movq    32(%rbx), %rax
        movq    (%rax), %rcx
        movl    8(%rax), %eax
        movq    %rcx, 80(%rsp)
        movl    %eax, 88(%rsp)
        leaq    2048(%r14), %r13
+       movl    88(%rsp), %eax
+       movl    %eax, 44(%rsp)          # 4-byte Spill
        movq    %r13, %rdi
        leaq    80(%rsp), %rsi
        callq  
_ZN4llvm12DenseMapBaseINS_13SmallDenseMapINS_7SDValueES2_Lj8ENS_12DenseMapInfoIS2_EEEES2_S2_S4_EixERKS2_

(and a couple of changes later because the spill changed from an 8-byte spill
to a 4-byte one).

The miscompiled version will cause an anomalous assertion failure when llc is
run on test/CodeGen/X86/vec_ext_inreg.ll</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>