llvm.org GIT mirror llvm / 6cf7e43
Revert "SDAG: Update ChainNodesMatched as nodes are deleted" Seeing failures in CodeGen/Generic/icmp-illegal.ll on quite a few bots. This reverts r271706. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271713 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Bogner 4 years ago
2 changed file(s) with 4 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
246246
247247 /// The node N that was updated.
248248 virtual void NodeUpdated(SDNode *N);
249 };
250
251 struct DAGNodeDeletedListener : public DAGUpdateListener {
252 std::function Callback;
253 DAGNodeDeletedListener(SelectionDAG &DAG,
254 std::function Callback)
255 : DAGUpdateListener(DAG), Callback(Callback) {}
256 void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); }
257249 };
258250
259251 /// When true, additional steps are taken to
21622162 // Replace all the chain results with the final chain we ended up with.
21632163 for (unsigned i = 0, e = ChainNodesMatched.size(); i != e; ++i) {
21642164 SDNode *ChainNode = ChainNodesMatched[i];
2165 assert(ChainNode->getOpcode() != ISD::DELETED_NODE &&
2166 "Deleted node left in chain");
2165
2166 // If this node was already deleted, don't look at it.
2167 if (ChainNode->getOpcode() == ISD::DELETED_NODE)
2168 continue;
21672169
21682170 // Don't replace the results of the root node if we're doing a
21692171 // MorphNodeTo.
33653367 } else {
33663368 assert(NodeToMatch->getOpcode() != ISD::DELETED_NODE &&
33673369 "NodeToMatch was removed partway through selection");
3368 SelectionDAG::DAGNodeDeletedListener NDL(*CurDAG, [&](SDNode *N,
3369 SDNode *E) {
3370 assert(!E && "Unexpected node replacement in MorphNode");
3371 ChainNodesMatched.erase(std::remove(ChainNodesMatched.begin(),
3372 ChainNodesMatched.end(), N),
3373 ChainNodesMatched.end());
3374 });
33753370 Res = MorphNode(NodeToMatch, TargetOpc, VTList, Ops, EmitNodeInfo);
33763371 }
33773372