Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit a646cd0

Browse files
committed
[DAG] check more operands for cycles when merging stores.
Until now, we've only checked whether merging stores would cause a cycle via the value argument, but the address and indexed offset arguments are also capable of creating cycles in some situations. The addresses are all base+offset with notionally the same base, but the base SDNode may still be different (e.g. via an indexed load in one case, and an ISD::ADD elsewhere). This allows cycles to creep in if one of these sources depends on another. The indexed offset is usually undef (representing a non-indexed store), but on some architectures (e.g. 32-bit ARM-mode ARM) it can be an arbitrary value, again allowing dependency cycles to creep in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345200 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent b143180 commit a646cd0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13981,14 +13981,14 @@ bool DAGCombiner::checkMergeStoreCandidatesForDependencies(
1398113981
// in candidate selection and can be
1398213982
// safely ignored
1398313983
// * Value (Op 1) -> Cycles may happen (e.g. through load chains)
13984-
// * Address (Op 2) -> Merged addresses may only vary by a fixed constant
13985-
// and so no cycles are possible.
13986-
// * (Op 3) -> appears to always be undef. Cannot be source of cycle.
13987-
//
13988-
// Thus we need only check predecessors of the value operands.
13989-
auto *Op = N->getOperand(1).getNode();
13990-
if (Visited.insert(Op).second)
13991-
Worklist.push_back(Op);
13984+
// * Address (Op 2) -> Merged addresses may only vary by a fixed constant,
13985+
// but aren't necessarily fromt the same base node, so
13986+
// cycles possible (e.g. via indexed store).
13987+
// * (Op 3) -> Represents the pre or post-indexing offset (or undef for
13988+
// non-indexed stores). Not constant on all targets (e.g. ARM)
13989+
// and so can participate in a cycle.
13990+
for (unsigned j = 1; j < N->getNumOperands(); ++j)
13991+
Worklist.push_back(N->getOperand(j).getNode());
1399213992
}
1399313993
// Search through DAG. We can stop early if we find a store node.
1399413994
for (unsigned i = 0; i < NumStores; ++i)

0 commit comments

Comments
 (0)