[PATCH] [DAGCombine] Fix bug in MergeConsecutiveStores

Akira Hatanaka ahatanak at gmail.com
Mon Apr 6 16:52:26 PDT 2015


Hi spatel, nadav,

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

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

and the store's values are extracted from the preceding vector loads.

The current code in trunk creates a build_vector node and then inserts the new merged store node between the two load nodes. This creates a cycle between the merged store node, the build_vector node, the extract_vector_elt node, and the second vector load (set a breakpoint at DAGCombiner.cpp:10056 to visualize the transformation), which eventually results in a crash during type legalization.

This patch fixes the bug by inserting the new merged store at the position of the last store node in the chain.

http://reviews.llvm.org/D8849

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/AArch64/merge-store.ll
  test/CodeGen/X86/2012-11-28-merge-store-alias.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8849.23301.patch
Type: text/x-patch
Size: 5478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150406/d2f1b1d5/attachment.bin>


More information about the llvm-commits mailing list