[llvm-branch-commits] [llvm] [TBAA] Only clear TBAAStruct if field can be extracted. (PR #81285)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Feb 9 11:27:00 PST 2024


================
@@ -821,13 +821,15 @@ MDNode *AAMDNodes::extendToTBAA(MDNode *MD, ssize_t Len) {
 AAMDNodes AAMDNodes::adjustForAccess(unsigned AccessSize) {
   AAMDNodes New = *this;
   MDNode *M = New.TBAAStruct;
-  New.TBAAStruct = nullptr;
   if (M && M->getNumOperands() == 3 && M->getOperand(0) &&
----------------
dobbelaj-snps wrote:

Isn't this too strict ? Typically the TBAAStruct have operands in multiple of 3 describing {offset, size, type }.

You can extract the 'first member' instead of matching the full struct. (Note: if we accept to track unions in more detail, this might get more complicated)

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


More information about the llvm-branch-commits mailing list