<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: UNREACHABLE "Operand not processed?""
   href="https://bugs.llvm.org/show_bug.cgi?id=36588">36588</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DAGCombiner: UNREACHABLE "Operand not processed?"
          </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>enhancement
          </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>paulsson@linux.vnet.ibm.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=19993" name="attach_19993" title="reduced testcase">attachment 19993</a> <a href="attachment.cgi?id=19993&action=edit" title="reduced testcase">[details]</a></span>
reduced testcase

A small, reduced csmith program seems to expose some bug in DAGCombiner where a
brcond gets incorrectly combined:

=== main
Initial selection DAG: %bb.0 'main:'
SelectionDAG has 16 nodes:
  t2: ch = seteq
    t6: i1 = setcc undef:i32, Constant:i32<0>, setne:ch
  t7: i1 = or t6, Constant:i1<-1>
        t0: ch = EntryToken
        t8: i32 = any_extend t7
      t10: ch = CopyToReg t0, Register:i32 %0, t8
      t11: i1 = xor t7, Constant:i1<-1>
    t13: ch = brcond t10, t11, BasicBlock:ch< 0x28c29288>
  t15: ch = br t13, BasicBlock:ch<.preheader 0x28c29108>

Optimized lowered selection DAG: %bb.0 'main:'
SelectionDAG has 8 nodes:
      t0: ch = EntryToken
    t10: ch = CopyToReg t0, Register:i32 %0, Constant:i32<1>
  t17: ch = brcond t10, t17, BasicBlock:ch< 0x28c29288>
  t15: ch = br t17, BasicBlock:ch<.preheader 0x28c29108>


Operand not processed?
t15: ch = br t17, BasicBlock:ch<.preheader 0x28c29108>


---


Initial selection DAG: %bb.0 'main:'
SelectionDAG has 16 nodes:
  t2: ch = seteq
    t6: i1 = setcc undef:i32, Constant:i32<0>, setne:ch
  t7: i1 = or t6, Constant:i1<-1>
        t0: ch = EntryToken
        t8: i32 = any_extend t7
      t10: ch = CopyToReg t0, Register:i32 %0, t8
      t11: i1 = xor t7, Constant:i1<-1>
    t13: ch = brcond t10, t11, BasicBlock:ch< 0x36a3afd8>
  t15: ch = br t13, BasicBlock:ch<.preheader 0x36a3ae58>


Combining: t15: ch = br t13, BasicBlock:ch<.preheader 0x36a3ae58>

Combining: t14: ch = BasicBlock<.preheader 0x36a3ae58>

Combining: t13: ch = brcond t10, t11, BasicBlock:ch< 0x36a3afd8>

Replacing.2 t11: i1 = xor t7, Constant:i1<-1>

With: t16: i1 = Constant<0>

 ... into: t17: ch = brcond t10, t17, BasicBlock:ch< 0x36a3afd8>

...

After first time in visitBRCOND(), the CC i1 becomes constant, and then things
seem to go wrong. t17 is then using itself which is impossible.

---

bin/llc -mtriple=s390x-linux-gnu -mcpu=z13  tc_isel.ll -o out.s -O3</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>