<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Infinite loop in DAGCombiner::Run"
   href="https://bugs.llvm.org/show_bug.cgi?id=46877">46877</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Infinite loop in DAGCombiner::Run
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ruhler@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, qshanz@cn.ibm.com, ruhler@google.com, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23783" name="attach_23783" title="The program and DAG that hangs.">attachment 23783</a> <a href="attachment.cgi?id=23783&action=edit" title="The program and DAG that hangs.">[details]</a></span>
The program and DAG that hangs.

For the program hangs.ll in the attached hangs.tar.gz, the following command
hangs:

  llc -O3 -mcpu=haswell hangs.ll

Debugging shows it is stuck in an infinite while loop processing the worklist
in the function DAGCombiner::Run in
llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp.

Debug logging suggests it is repeatedly trying to combine the same node without
making any progress:

Combining: t2747: f32 = fmul nsz contract reassoc t2742, t2746
Combining: t2604: f32 = fmul nsz contract reassoc t2594, t2636
Combining: t2746: f32 = fmul nsz contract reassoc t2744, t36
Combining: t2747: f32 = fmul nsz contract reassoc t2742, t2746
Combining: t2689: f32 = fmul nsz contract reassoc t52, t2726
Combining: t2746: f32 = fmul nsz contract reassoc t2744, t36
Combining: t2747: f32 = fmul nsz contract reassoc t2742, t2746
...

See dag.txt in the attached hangs.tar.gz for a dump of the DAG in question and
additional debug logs.

The infinite loop reproduces on trunk today (git revision
3fac05e49fe3eb4d6becf1761b4df01dbd871aa4).

git bisect shows the infinite loop first started appearing at:

commit 2b59e9f1bdd8d0f8a315f9ddba2cdc87a3e682fb
Author: QingShan Zhang <<a href="mailto:qshanz@cn.ibm.com">qshanz@cn.ibm.com</a>>
Date:   Wed May 20 02:11:16 2020 +0000

    [DAGCombine] Remove the getNegatibleCost to avoid the out of sync with
getNegatedExpression</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>