From 63854f91d3ee1056796a5ef27753648396cac6ec Mon Sep 17 00:00:00 2001 From: Chen Zheng Date: Tue, 7 Feb 2023 00:31:45 -0500 Subject: [PATCH] [DAGCombiner] fix comments for D138899; NFC --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 112d729..dbbbcd1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -362,6 +362,10 @@ namespace { SDValue SplitIndexingFromLoad(LoadSDNode *LD); bool SliceUpLoad(SDNode *N); + // Looks up the chain to find a unique (unaliased) store feeding the passed + // load. If no such store is found, returns a nullptr. + // Note: This will look past a CALLSEQ_START if the load is chained to it so + // so that it can find stack stores for byval params. StoreSDNode *getUniqueStoreFeeding(LoadSDNode *LD, int64_t &Offset); // Scalars have size 0 to distinguish from singleton vectors. SDValue ForwardStoreValueToDirectLoad(LoadSDNode *LD); @@ -17460,14 +17464,14 @@ StoreSDNode *DAGCombiner::getUniqueStoreFeeding(LoadSDNode *LD, continue; BaseIndexOffset BasePtrLD = BaseIndexOffset::match(LD, DAG); BaseIndexOffset BasePtrST = BaseIndexOffset::match(Store, DAG); - if (BasePtrST.equalBaseIndex(BasePtrLD, DAG, Offset)) { - // Make sure the store is not aliased with any nodes in TokenFactor. - GatherAllAliases(Store, Chain, Aliases); - if (Aliases.empty() || - (Aliases.size() == 1 && Aliases.front().getNode() == Store)) - ST = Store; - break; - } + if (!BasePtrST.equalBaseIndex(BasePtrLD, DAG, Offset)) + continue; + // Make sure the store is not aliased with any nodes in TokenFactor. + GatherAllAliases(Store, Chain, Aliases); + if (Aliases.empty() || + (Aliases.size() == 1 && Aliases.front().getNode() == Store)) + ST = Store; + break; } } else { StoreSDNode *Store = dyn_cast(Chain.getNode()); -- 2.7.4