[DAGCombine] Fix a bug in MergeConsecutiveStores.
authorAkira Hatanaka <ahatanaka@apple.com>
Wed, 8 Apr 2015 20:34:53 +0000 (20:34 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Wed, 8 Apr 2015 20:34:53 +0000 (20:34 +0000)
commit522877813a174e5aa6b96d9babc70da38b45e06d
tree32a69933fecc323524e15590e55fd26112f889b2
parent1568175235766d9dcf6bad89b9b4571f6c2b598b
[DAGCombine] Fix a bug in MergeConsecutiveStores.

The bug manifests when there are two loads and two stores chained as follows in
a DAG,

(ld v3f32) -> (st f32) -> (ld v3f32) -> (st f32)

and the stores' values are extracted from the preceding vector loads.

MergeConsecutiveStores would replace the first store in the chain with the
merged vector store, which would create a cycle between the merged store node
and the last load node that appears in the chain.

This commits fixes the bug by replacing the last store in the chain instead.

rdar://problem/20275084

Differential Revision: http://reviews.llvm.org/D8849

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