[PATCH] D61843: [DAGCombine] Match a pattern where a wide type scalar value is stored by several narrow stores

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 19:25:18 PDT 2019

steven.zhang marked 2 inline comments as done.
steven.zhang added a comment.

Yes, I tried but decide not to reuse it. Because, the load pattern is trying to find out the load sequences that they are SHIFT and OR together, so, they have to walk the tree recursively to collect all the loads. But the store pattern is much easier. Because, We already know the stores from the chain. What we need to do is to check if all the store values are from some fixed pattern.

Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6219-6233
+    // All the stores store different byte of the CombinedValue. A truncate is
+    // required to get that byte value.
+    SDValue Trunc = Store->getValue();
+    if (Trunc.getOpcode() != ISD::TRUNCATE)
+      return SDValue();
+    // A shift operation is required to get the right byte offset, except the
+    // first byte.
apilipenko wrote:
> Can you add a comment outlining the pattern you are looking for? It would be easier to grasp from a short comment than from the implementation.

Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6318
+  DAG.ReplaceAllUsesWith(N, NewStore.getNode());
+  return NewStore;
apilipenko wrote:
> What happens to the individual stores after? Do you rely on other DAG combine rules to remove them?



More information about the llvm-commits mailing list