@@ -21366,35 +21366,33 @@ bool DAGCombiner::tryStoreMergeOfLoads(SmallVectorImpl<MemOpLink> &StoreNodes,
2136621366 // Check if a call exists in the store chain.
2136721367 auto HasCallInLdStChain = [](SDNode *Load, SDNode *Store) {
2136821368 SmallPtrSet<const SDNode *, 32> Visited;
21369- SmallVector<const SDNode *, 8> Worklist;
21370- Worklist.push_back (Store->getOperand(0).getNode());
21369+ SmallVector<std::pair< const SDNode *, bool> , 8> Worklist;
21370+ Worklist.emplace_back (Store->getOperand(0).getNode(), false );
2137121371
21372- bool FoundCall = false;
2137321372 while (!Worklist.empty()) {
21374- auto Node = Worklist.pop_back_val();
21373+ auto [ Node, FoundCall] = Worklist.pop_back_val();
2137521374 if (!Visited.insert(Node).second || Node->getNumOperands() == 0)
2137621375 continue;
2137721376
2137821377 switch (Node->getOpcode()) {
21378+ case ISD::CALLSEQ_END:
21379+ Worklist.emplace_back(Node->getOperand(0).getNode(), true);
21380+ break;
2137921381 case ISD::TokenFactor:
2138021382 for (SDValue Op : Node->ops())
21381- Worklist.push_back(Op.getNode());
21382- break;
21383- case ISD::CALLSEQ_END:
21384- FoundCall = true;
21383+ Worklist.emplace_back(Op.getNode(), FoundCall);
2138521384 break;
2138621385 case ISD::LOAD:
2138721386 if (Node == Load)
21388- return false;
21389- [[fallthrough]];
21390- case ISD::STORE:
21391- Worklist.push_back(Node->getOperand(0).getNode());
21387+ return FoundCall;
2139221388 [[fallthrough]];
2139321389 default:
21390+ if (Node->getNumOperands() > 0)
21391+ Worklist.emplace_back(Node->getOperand(0).getNode(), FoundCall);
2139421392 break;
2139521393 }
2139621394 }
21397- return FoundCall ;
21395+ return false ;
2139821396 };
2139921397
2140021398 auto StIt = StoreNodes.begin();
0 commit comments