[PATCH] D102255: [SelectionDAG] Generate scoped AA metadata when lowering memcpy.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 20:10:16 PDT 2021


hliao added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6399-6422
+  AAMDNodes DstAAInfo, SrcAAInfo;
+  DstAAInfo = SrcAAInfo = NewAAInfo;
+  // Generate new scoped AA metadata for this memcpy instance if enabled.
+  if (EnableMemCpyScopedNoAlias) {
+    MDBuilder MDB(*DAG.getContext());
+    MDNode *Domain =
+        MDB.createAnonymousAliasScopeDomain("MemcpyLoweringDomain");
----------------
jeroen.dobbelaere wrote:
> As mentioned in  D102255#2766721, we still would need to use separate scopes for ever load/store pair.
> That's the only way to avoid a possible 'noalias' result when the source and destination happen to be identical.
> (based on the AA Techcall discussion, such a situation was considered to be not acceptable).
Separating scopes for each load/store pair make it impossible to schedule loads/stores freely generated from the same memcpy as they won't belong to the same scope. The exact overlap described in memcpy builtin refers to the situation where an optimizer should not assume distinct memory operands from the outside of memcpy.
In another perspective, such lowering of memcpy is eqivalent to inlining a memcpy function implementation at the LLVM IR level.
Could you explain more about the concern?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102255/new/

https://reviews.llvm.org/D102255



More information about the llvm-commits mailing list