[PATCH] D16463: [DAGCombiner] Check store node's value count before replaceStoreChain

Junmo Park via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 03:45:52 PST 2016


flyingforyou created this revision.
flyingforyou added a reviewer: arsenm.
flyingforyou added a subscriber: llvm-commits.

"replaceStoreChain" uses CombineTo which only consider "Chain" only.
So, we need to check store node's value count for ensuring store node only has a "Chain" value.

http://reviews.llvm.org/D16463

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14777,6 +14777,11 @@
   SmallVector<std::pair<StoreSDNode *, SDValue>, 8> BetterChains;
 
   for (StoreSDNode *ChainedStore : ChainedStores) {
+    // If ChainedStore has more than one value, we don't try replaceStoreChain.
+    // replaceStoreChain uses CombineTo, which only consider Chain only.
+    if (ChainedStore->getNumValues() != 1)
+      continue;
+
     SDValue Chain = ChainedStore->getChain();
     SDValue BetterChain = FindBetterChain(ChainedStore, Chain);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16463.45678.patch
Type: text/x-patch
Size: 685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160122/e992c22e/attachment.bin>


More information about the llvm-commits mailing list