[PATCH] [AArch64]Redundant store instructions should be removed as dead code

Chad Rosier mcrosier at codeaurora.org
Wed Sep 24 07:32:57 PDT 2014


LGTM, with a few comments.

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9797
@@ +9796,3 @@
+  if (StoreSDNode *ST1 = dyn_cast<StoreSDNode>(Chain)) {
+    if (ST1->getBasePtr() == Ptr && ST->getMemoryVT() == ST1->getMemoryVT() &&
+        ST1->getValue() == Value && ST->isUnindexed() && !ST->isVolatile() &&
----------------
What if the 2nd store is a larger value type?  Wouldn't the first store still be dead?

(Just a comment that, if true, doesn't need to be addresses in this patch.)

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9800
@@ +9799,3 @@
+        ST1->isUnindexed() &&
+        !ST1->isVolatile() &&
+        // There can't be any side effects between the store and store, such as
----------------
Just move this line up to maximize horizontal space and reduce vertical space (i.e., "ST1->isunindexed() && !ST1->isVolatie() &&").

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9801
@@ +9800,3 @@
+        !ST1->isVolatile() &&
+        // There can't be any side effects between the store and store, such as
+        // a call or store.
----------------
"between the two stores", perhaps.

http://reviews.llvm.org/D5455






More information about the llvm-commits mailing list