HomePhabricator

[DAGCombine] Don't delete the node if it has uses immediately

Authored by steven.zhang on Aug 28 2020, 8:21 AM.

Description

[DAGCombine] Don't delete the node if it has uses immediately

This is the follow up patch for https://reviews.llvm.org/D86183 as we miss to delete the node if NegX == NegY, which has use after we create the node.

if (NegX && (CostX <= CostY)) {
  Cost = std::min(CostX, CostZ);
  RemoveDeadNode(NegY);
  return DAG.getNode(Opcode, DL, VT, NegX, Y, NegZ, Flags);  #<-- NegY is used here if NegY == NegX.
}

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D86689

Details