[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
Mon Sep 21 16:48:16 PDT 2026
================
@@ -748,6 +748,35 @@ MDNode *AAMDNodes::shiftTBAA(MDNode *MD, size_t Offset) {
return MD;
}
+// Read a !tbaa.struct field entry (an offset or a size) into Out as a 64-bit
+// value. Returns false if it is not a constant integer that fits in 64 bits.
+static bool getTBAAStructFieldAsInt64(const MDOperand &Op, uint64_t &Out) {
+ auto *CI = mdconst::dyn_extract_or_null<ConstantInt>(Op);
+ if (!CI)
+ return false;
+ std::optional<uint64_t> Val = CI->getValue().tryZExtValue();
+ if (!Val)
+ return false;
+ Out = *Val;
+ return true;
----------------
AbhayKanhere wrote:
yes looks like it. fixed.
https://github.com/llvm/llvm-project/pull/214116
More information about the llvm-commits
mailing list