From fbfe2ad9e059b74f4796d63cbbf1917547f363e2 Mon Sep 17 00:00:00 2001 From: Nirav Dave Date: Tue, 14 Aug 2018 16:20:43 +0000 Subject: [PATCH] [DAG] Avoid redundant chain transversal in store merge cycle check. NFCI. Patch by Henric Karlsson. llvm-svn: 339688 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index aaff88a..5405f79 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -13971,11 +13971,12 @@ bool DAGCombiner::checkMergeStoreCandidatesForDependencies( Worklist.push_back(RootNode); while (!Worklist.empty()) { auto N = Worklist.pop_back_val(); + if (!Visited.insert(N).second) + continue; // Already present in Visited. if (N->getOpcode() == ISD::TokenFactor) { for (SDValue Op : N->ops()) Worklist.push_back(Op.getNode()); } - Visited.insert(N); } // Don't count pruning nodes towards max. -- 2.7.4