[llvm] [TBAA] Recover !tbaa for a memcpy of struct with same type fields (PR #214116)

Abhay Kanhere via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 10:52:08 PDT 2026


================
@@ -818,7 +818,29 @@ AAMDNodes AAMDNodes::adjustForAccess(unsigned AccessSize) {
       M->getOperand(2) && isa<MDNode>(M->getOperand(2)))
     New.TBAA = cast<MDNode>(M->getOperand(2));
 
+  // The access may cover several !tbaa.struct fields (e.g. a {int, int} copy
+  // widened to an i64 load/store). If those fields share a single tag and tile
+  // [0, AccessSize) with no gaps, that tag still describes the whole access.
   New.TBAAStruct = nullptr;
+  if (New.TBAA || !M)
+    return New;
+  MDNode *CommonTag = nullptr;
+  uint64_t Offset = 0;
+  for (size_t I = 0, E = M->getNumOperands(); I < E; I += 3) {
----------------
AbhayKanhere wrote:

I dont have commit rights yet. And I did not see approval so I was waiting.

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


More information about the llvm-commits mailing list