[PATCH] D13519: [MemCpyOpt] Fix wrong merging of adjacent nontemporal stores into memset calls.

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 06:53:38 PDT 2015


andreadb added inline comments.

================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:495
@@ +494,3 @@
+  if (SI->getMetadata(LLVMContext::MD_nontemporal))
+    return false;
+
----------------
qcolombet wrote:
> Would it make sense tp extend the metadata to allow this propagation to happen?
> I believe the problem here is that we need to differentiate between the load or the store being non-temporal.
Hi Quentin,

Are you suggesting to extend the usage of !nontemporal metadata to memcpy/memset calls as well? If my understanding is correct then yes, that would definitely enable the merging of nontemporal stores.

However - correct me if I am wrong - I am under the impression that a change like that would only have the effect of forcing the backend to expand !nontemporal memsets back to sequences of store instructions.
A memset library call would not have the same semantic of a builtin !nontemporal memset call. So, SelectionDAG will have to conservatively expand it back to a sequence of !nontemporal stores (effectively undoing the merging).
So, unless I got it completely wrong (which may be the case :-) ), I find it difficult to justify a change like that one.

What do you think?


http://reviews.llvm.org/D13519





More information about the llvm-commits mailing list