mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 20:23:59 +00:00
[TBAA] Fix handling of mixed TBAA (path-aware and non-path-aware TBAA).
This fix simply ensures that both metadata nodes are path-aware before performing path-aware alias analysis. This issue isn't normally triggered in LLVM, because we perform an autoupgrade of the TBAA metadata to the new format when reading in LL or BC files. This issue only appears when a client creates the IR manually and mixes old and new TBAA metadata format. This fixes <rdar://problem/16760860>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207923 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -339,7 +339,8 @@ static bool isStructPathTBAA(const MDNode *MD) {
|
||||
bool
|
||||
TypeBasedAliasAnalysis::Aliases(const MDNode *A,
|
||||
const MDNode *B) const {
|
||||
if (isStructPathTBAA(A))
|
||||
// Make sure that both MDNodes are struct-path aware.
|
||||
if (isStructPathTBAA(A) && isStructPathTBAA(B))
|
||||
return PathAliases(A, B);
|
||||
|
||||
// Keep track of the root node for A and B.
|
||||
@ -385,6 +386,10 @@ TypeBasedAliasAnalysis::Aliases(const MDNode *A,
|
||||
bool
|
||||
TypeBasedAliasAnalysis::PathAliases(const MDNode *A,
|
||||
const MDNode *B) const {
|
||||
// Verify that both input nodes are struct-path aware.
|
||||
assert(isStructPathTBAA(A) && "MDNode A is not struct-path aware.");
|
||||
assert(isStructPathTBAA(B) && "MDNode B is not struct-path aware.");
|
||||
|
||||
// Keep track of the root node for A and B.
|
||||
TBAAStructTypeNode RootA, RootB;
|
||||
TBAAStructTagNode TagA(A), TagB(B);
|
||||
@ -560,7 +565,7 @@ MDNode *MDNode::getMostGenericTBAA(MDNode *A, MDNode *B) {
|
||||
return A;
|
||||
|
||||
// For struct-path aware TBAA, we use the access type of the tag.
|
||||
bool StructPath = isStructPathTBAA(A);
|
||||
bool StructPath = isStructPathTBAA(A) && isStructPathTBAA(B);
|
||||
if (StructPath) {
|
||||
A = cast_or_null<MDNode>(A->getOperand(1));
|
||||
if (!A) return nullptr;
|
||||
|
Reference in New Issue
Block a user