Make AAMDNodes' getAAMetadata() and setAAMetadata() to take !tbaa.struct
into account like for !tbaa. This impacts llvm.org/pr42022.
This is a temprorary fix needed to keep !tbaa.struct tag by SROA pass. New field TBAAStruct should be deleted when !tbaa tag replaces !tbaa.struct. Merging two !tbaa.struct's to one is conservatively considered to be nullptr (giving MayAlias) -- this could be enhanced, but relying on the said replacement.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 43251 Build 44015: arc lint + arc unit
Event Timeline
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp | ||
---|---|---|
527 | Does MDNode::getMostGenericTBAA actually support struct.tbaa metadata? I didn't think that it did. |
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp | ||
---|---|---|
527 | No, it really didn't. Fixing it. |
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp | ||
---|---|---|
527 | Updated. I conservatively suppose that merging two !tbaa.struct's turns to MayAlias. |
This replacing !tbaa.struct->!tbaa is described at the topic http://lists.llvm.org/pipermail/llvm-dev/2017-October/118284.html started by @kosarev, and I see it has already been supported and almost commited (but not announced). So my patch looks like temprorary bug fixing until this transfer is finished.
It might, but it depends on the progress on the new TBAA format. This is not a large change, and I think that we can proceed with this regardless.
Can you please explain what will end up using this information? That should be present in the description.
llvm/include/llvm/IR/Metadata.h | ||
---|---|---|
647 | I always get worried when constructors with default args get rearranged like this. Maybe change to this: explicit AAMDNodes() = default; explicit AAMDNodes(MDNode *T, MDNode *TS, MDNode *S, MDNode *N) : TBAA(T), TBAAStruct(TS), Scope(S), NoAlias(N) {} MDNode *TBAA = nullptr; // etc. |
llvm/include/llvm/IR/Metadata.h | ||
---|---|---|
647 | Ok, done. |
I always get worried when constructors with default args get rearranged like this. Maybe change to this: