Use new TokenFactor chain when merging stores
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 24 Sep 2015 07:22:38 +0000 (07:22 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 24 Sep 2015 07:22:38 +0000 (07:22 +0000)
commitfc091f40c912e078cee0cff708b8a2c824444bf1
tree888b704aba02dc5ec311d6fa2f2b07b7e17a15aa
parentbb9c0afde53073f3fcd30c851420d58c950127fa
Use new TokenFactor chain when merging stores

If the stores are storing values from loads which partially
alias the stores, we could end up placing the merged loads
and stores on the same chain which has the potential to break.
Each store may have a different chain dependency on only some
of the original loads. Create a new TokenFactor to capture all
of the required dependencies of the stores rather than assuming
all stores can use the same chain.

The testcase is a situation where this happens, although
it does not have an observable change from this. The DAG nodes
just happened to not be reordered before despite this missing
chain dependency.

This is based on an off-list report for an out of tree target
which regressed due to r246307 and I haven't managed to find a case
where the nodes do end up reordered with an in tree target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248468 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/merge-store-partially-alias-loads.ll [new file with mode: 0644]