<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 - DAGCombiner hang in a infinite loop"
   href="https://bugs.llvm.org/show_bug.cgi?id=39098">39098</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DAGCombiner hang in a 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>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>karl-johan.karlsson@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20932" name="attach_20932" title="llc -O0 bugpoint-reduced-simplified.ll">attachment 20932</a> <a href="attachment.cgi?id=20932&action=edit" title="llc -O0 bugpoint-reduced-simplified.ll">[details]</a></span>
llc -O0 bugpoint-reduced-simplified.ll

The following minimal reproducer hang in a infine loop in the DAGCombiner. It
seems to ping-pong between two different states but never make any progress.

Reproduce with:

llc -O0 bugpoint-reduced-simplified.ll -debug-pass=Executions

llvm assembler code (also attached):

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define dso_local void @test_cancel2() {
entry:
  %0 = load i40, i40* undef, align 8
  %shl414 = shl i40 %0, 19
  %unsclear415 = and i40 %shl414, 549755813887
  %shr416 = lshr i40 %unsclear415, 20
  %unsclear417 = and i40 %shr416, 549755813887
  store i40 %unsclear417, i40* undef, align 8
  ret void
}

backtrace:

#0  0x00007ffff7bcb330 in __write_nocancel ()
    at ../sysdeps/unix/syscall-template.S:81
#1  0x000000000208899a in llvm::raw_fd_ostream::write_impl(char const*,
unsigned long) ()
#2  0x00000000020878fc in llvm::raw_ostream::write(char const*, unsigned long)
    ()
#3  0x00000000020876f0 in llvm::raw_ostream::write(unsigned char) ()
#4  0x0000000001f17fa6 in llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc
const&, llvm::EVT, llvm::SDValue, llvm::SDValue, llvm::SDNodeFlags) ()
#5  0x0000000001e180ed in (anonymous
namespace)::DAGCombiner::visitZERO_EXTEND(llvm::SDNode*) ()
#6  0x0000000001de01d1 in (anonymous
namespace)::DAGCombiner::visit(llvm::SDNode*) ()
#7  0x0000000001ddbc0c in (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*) ()
#8  0x0000000001ddb3e8 in llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults*, llvm::CodeGenOpt::Level) ()
#9  0x0000000001f5f96c in llvm::SelectionDAGISel::CodeGenAndEmitDAG() ()
#10 0x0000000001f5d8bb in
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) ()
#11 0x0000000001f599ec in
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) ()
#12 0x000000000123c391 in (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) ()
#13 0x0000000001795a9d in
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) ()
#14 0x0000000001acb24d in llvm::FPPassManager::runOnFunction(llvm::Function&)
    ()
#15 0x0000000001acb508 in llvm::FPPassManager::runOnModule(llvm::Module&) ()
#16 0x0000000001acb96a in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
#17 0x00000000007183e9 in compileModule(char**, llvm::LLVMContext&) ()
#18 0x0000000000715bd0 in main ()</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>