<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 - llvm-stress causes DAGCombiner crash"
   href="https://bugs.llvm.org/show_bug.cgi?id=32372">32372</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-stress causes DAGCombiner crash
          </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>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=18145" name="attach_18145" title="reduced test case">attachment 18145</a> <a href="attachment.cgi?id=18145&action=edit" title="reduced test case">[details]</a></span>
reduced test case

Reduced test case, when run with

llc -mtriple=s390x-linux-gnu -mcpu=z13

results in

llc: /home/jonas/llvm/llvm-dev/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:746:
bool llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*): Assertion
`N->getOpcode() != ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"' failed.

At first glance, it seems that the
CombineTo(N, (N0.getNode() == Load) ? NewLoad : N0);
in visitAND() should be guarded with a check if N or N0 has already been
deleted?

----
backtracking:


21: DAG.dump() = SelectionDAG has 21 nodes:
  t0: ch = EntryToken
  t2: i64,ch = CopyFromReg t0, Register:i64 %vreg2
  t32: i32,ch = load<LD1[%0], zext from i8> t0, t2, undef:i64
  t38: i32,ch = load<LD1[%0], anyext from i8> t0, t2, undef:i64
  t44: i32 = Constant<-1>
          t41: i32 = and t32, Constant:i32<255>
          t42: i32 = and t38, Constant:i32<255>
        t43: i32 = urem t41, t42
      t22: v16i8 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, t43, undef:i32, undef:i32, undef:i32, undef:i32, undef:i32,
undef:i32, undef:i32, undef:i32
    t24: ch = CopyToReg t0, Register:v16i8 %vreg0, t22
    t28: ch = CopyToReg t0, Register:i32 %vreg1, t32
    t39: ch = store<ST2[undef], trunc to i16> t38:1, Constant:i32<-3825>,
undef:i64, undef:i64
  t29: ch = TokenFactor t24, t28, t39

Combining: t42: i32 = and t38, Constant:i32<255>

SDValue DAGCombiner::visitAND()  ->

(gdb) p N->dump()
t42: i32 = and t38, Constant:i32<255>
CombineTo(Load, NewLoad.getValue(0), NewLoad.getValue(1));
(gdb) p N0->dump()

t38: i32,ch = load<LD1[%0], anyext from i8> t0, t2, undef:i64  ->

(gdb) p N->dump()
t42: i32 = <<Deleted Node!>>
(gdb) p N0->dump()
t38: i32,ch = <<Deleted Node!>>

// Fold the AND away, taking care not to fold to the old load node if we
// replaced it.
CombineTo(N, (N0.getNode() == Load) ? NewLoad : N0); ->

Replacing.1 t42: i32 = <<Deleted Node!>>

With: t32: i32,ch = load<LD1[%0], zext from i8> t0, t2, undef:i64
 and 0 other values
llc: /home/jonas/llvm/llvm-dev/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:746:
bool llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*): Assertion
`N->getOpcode() != ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"' failed.</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>