[llvm] [LLVM][MemCpyOpt] Unify alias tags if we optimize allocas (PR #129537)

Dominik Adamski via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 03:00:57 PDT 2025


================
@@ -1680,11 +1680,16 @@ bool MemCpyOptPass::performStackMoveOptzn(Instruction *Load, Instruction *Store,
   }
 
   // As this transformation can cause memory accesses that didn't previously
-  // alias to begin to alias one another, we remove !noalias metadata from any
-  // uses of either alloca. This is conservative, but more precision doesn't
-  // seem worthwhile right now.
-  for (Instruction *I : NoAliasInstrs)
+  // alias to begin to alias one another, we remove !alias.scope, !noalias,
+  // !tbaa and !tbaa_struct metadata from any uses of either alloca.
+  // This is conservative, but more precision doesn't seem worthwhile
+  // right now.
+  for (Instruction *I : AAMetadataInstrs) {
+    I->setMetadata(LLVMContext::MD_alias_scope, nullptr);
----------------
DominikAdamski wrote:

I also remove !alias.scope metadata

https://github.com/llvm/llvm-project/pull/129537


More information about the llvm-commits mailing list