[PATCH] D91576: [MemCpyOpt] Bail on call slot optimization if it merges alias scopes

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 00:57:30 PST 2020


jeroen.dobbelaere added a comment.

I would not block the optimization, but just get the !alias.scope metadata correct



================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:988
   // handled here, but combineMetadata doesn't support them yet
   unsigned KnownIDs[] = {LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope,
                          LLVMContext::MD_noalias,
----------------
Omit MD_alias_scope, as the 'default merge' mechanism is definitely invalid for this case.
Replace it (after the combineMetadata) with something like:

if (C->getMetadata(LLVMContext::MD_alias_scope) != cpyLoad->getMetadata(LLVMContext::MD_alias_scope)
  C->setMetadata(LLVMContext::MD_alias_scope, nullptr);

(and add a decent comment ;) )



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

https://reviews.llvm.org/D91576



More information about the llvm-commits mailing list