summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
index 5c92adbd2a2..e920c4c4e6b 100644
--- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -457,8 +457,12 @@ MDNode *MDNode::getMostGenericTBAA(MDNode *A, MDNode *B) {
--IB;
}
- if (!Ret)
+ // We either did not find a match, or the only common base "type" is
+ // the root node. In either case, we don't have any useful TBAA
+ // metadata to attach.
+ if (!Ret || Ret->getNumOperands() < 2)
return nullptr;
+
// We need to convert from a type node to a tag node.
Type *Int64 = IntegerType::get(A->getContext(), 64);
Metadata *Ops[3] = {Ret, Ret,
OpenPOWER on IntegriCloud