<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] visitBRCOND() leads to UNREACHABLE: "Operand not processed?""
   href="https://bugs.llvm.org/show_bug.cgi?id=36901">36901</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DAGCombiner]  visitBRCOND() leads to 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=20122" name="attach_20122" title="reduced testcase">attachment 20122</a> <a href="attachment.cgi?id=20122&action=edit" title="reduced testcase">[details]</a></span>
reduced testcase

DAG:

  t5: i32 = Constant<0>
  t6: i32 = Constant<-1>
  t7: ch = setgt
    t4: i1 = setcc undef:i32, Constant:i32<-8>, setlt:ch
  t11: i1 = or t4, Constant:i1<-1>
    t10: i1 = setcc undef:i32, Constant:i32<-9>, setlt:ch
  t12: i1 = and t11, t10
      t0: ch = EntryToken
      t13: i1 = xor t11, Constant:i1<-1>
    t15: ch = brcond t0, t13, BasicBlock:ch< 0x5373f68>
  t17: ch = br t15, BasicBlock:ch< 0x5374428>

visitBRCOND() calls rebuildSetCC() which correctly replaces t13 like:

t15: ch = brcond t0, Constant:i1<0>, BasicBlock:ch< 0x5373f68>

After visit(N) (in combine()) returns, the DAG looks like

  t0: ch = EntryToken
  t5: i32 = Constant<0>
  t6: i32 = Constant<-1>
  t7: ch = setgt
      t4: i1 = setcc undef:i32, Constant:i32<-8>, setlt:ch
    t11: i1 = or t4, Constant:i1<-1>
    t10: i1 = setcc undef:i32, Constant:i32<-9>, setlt:ch
  t12: i1 = and t11, t10
    t15: ch = brcond t0, Constant:i1<0>, BasicBlock:ch< 0x5373f68>
  t17: ch = br t15, BasicBlock:ch< 0x5374428>

However, the returned RV looks like

t19: ch = brcond t0, t19, BasicBlock:ch< 0x5373f68>

, which has itself as operand! This is inserted into the DAG...

Runline:

llc -mtriple=s390x-linux-gnu -mcpu=z13 tc_brcond.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>