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

Amaury SECHET via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 11:24:59 PST 2016


deadalnix added inline comments.

================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:639
@@ +638,3 @@
+    auto *T = V->getType();
+    if (T->isAggregateType()) {
+      uint64_t Size = DL.getTypeStoreSize(T);
----------------
joker.eph wrote:
> 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.
Yes, also one element aggregate would have been unpacked away by instcombine at this stage, so only somewhat large aggregate will be memsetted here.

It is done after tryMergingIntoMemset because it is indeed less profitable so we want the most profitable optimization tried first.


http://reviews.llvm.org/D15923





More information about the llvm-commits mailing list