[PATCH] D15923: Promote aggregate store to memset when possible

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 10:57:12 PST 2016


joker.eph added inline comments.

================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:537
@@ -536,3 +536,2 @@
             if (AA.getModRefInfo(&*I, StoreLoc) != MRI_NoModRef) {
-              DEBUG(dbgs() << "Alias " << *I << "\n");
               P = nullptr;
----------------
Unrelated change? Please commit separately if you want it.

================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:639
@@ +638,3 @@
+    auto *T = V->getType();
+    if (T->isAggregateType()) {
+      uint64_t Size = DL.getTypeStoreSize(T);
----------------
It is not intuitive (to me at least) that it is always a good thing, especially since `tryMergingIntoMemset` just above has a notion of profitability.
If I understand correctly, you're doing it unconditionally for aggregate because the rest of the optimizer is not dealing nicely with them, right?
If this is correct, please add a comment here explaining this.


http://reviews.llvm.org/D15923





More information about the llvm-commits mailing list