<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 - X86 ISel gets stuck in infinite loop"
   href="https://bugs.llvm.org/show_bug.cgi?id=40793">40793</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>X86 ISel gets stuck in infinite loop
          </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>All
          </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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>andrew@scheidecker.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21498" name="attach_21498" title="IR that triggers bug">attachment 21498</a> <a href="attachment.cgi?id=21498&action=edit" title="IR that triggers bug">[details]</a></span>
IR that triggers bug

Using SVN revision 354401 (from 2019/02/19), llc gets stuck in a loop on the
attached input, when run with the command-line:

  llc llvm-lock.ll -mcpu=skylake-avx512

Using llc from the LLVM 6.0 release does not get stuck in a loop.

Running it with e.g. -mcpu=skylake also does not get stuck in a loop. Based on
this, I've assumed this is an X86/AVX512 target specific bug.

Passing -debug prints the following in a loop:

  Promoting t1036: i16 = and t46, Constant:i16<15>
  Creating new node: t1038: i32 = any_extend t46
  Creating constant: t1039: i32 = Constant<15>
  Creating new node: t1040: i32 = and t1038, Constant:i32<15>
  Creating new node: t1041: i16 = truncate t1040

  Replacing.1 t1036: i16 = and t46, Constant:i16<15>

  With: t1041: i16 = truncate t1040
   and 0 other values

  Combining: t1037: i32 = srl Constant:i32<32733>, t1041
  Creating new node: t1042: i16 = and t46, Constant:i16<15>
  Creating new node: t1043: i32 = srl Constant:i32<32733>, t1042
   ... into: t1043: i32 = srl Constant:i32<32733>, t1042

  Combining: t39: i32 = Constant<32733>

  Combining: t43: i64 = any_extend t1043

  Combining: t1043: i32 = srl Constant:i32<32733>, t1042

  Combining: t1042: i16 = and t46, Constant:i16<15>

Breaking into the debugger shows this call stack:

  `anonymous namespace'::DAGCombiner::CombineTo
  `anonymous namespace'::DAGCombiner::CombineTo
  `anonymous namespace'::DAGCombiner::PromoteIntBinOp
  `anonymous namespace'::DAGCombiner::combine
  `anonymous namespace'::DAGCombiner::Run
  llvm::SelectionDAG::Combine
  llvm::SelectionDAGISel::CodeGenAndEmitDAG
  llvm::SelectionDAGISel::SelectBasicBlock
  llvm::SelectionDAGISel::SelectAllBasicBlocks
  llvm::SelectionDAGISel::runOnMachineFunction
  `anonymous namespace'::X86DAGToDAGISel::runOnMachineFunction
  llvm::MachineFunctionPass::runOnFunction
  llvm::FPPassManager::runOnFunction
  llvm::FPPassManager::runOnModule</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>