}
}
+MDNode *MDNode::concatenate(MDNode *A, MDNode *B) {
+ if (!A)
+ return B;
+ if (!B)
+ return A;
+
+ SmallVector<Value *, 4> Vals(A->getNumOperands() +
+ B->getNumOperands());
+
+ unsigned j = 0;
+ for (unsigned i = 0, ie = A->getNumOperands(); i != ie; ++i)
+ Vals[j++] = A->getOperand(i);
+ for (unsigned i = 0, ie = B->getNumOperands(); i != ie; ++i)
+ Vals[j++] = B->getOperand(i);
+
+ return MDNode::get(A->getContext(), Vals);
+}
+
+MDNode *MDNode::intersect(MDNode *A, MDNode *B) {
+ if (!A || !B)
+ return nullptr;
+
+ SmallVector<Value *, 4> Vals;
+ for (unsigned i = 0, ie = A->getNumOperands(); i != ie; ++i) {
+ Value *V = A->getOperand(i);
+ for (unsigned j = 0, je = B->getNumOperands(); j != je; ++j)
+ if (V == B->getOperand(j)) {
+ Vals.push_back(V);
+ break;
+ }
+ }
+
+ return MDNode::get(A->getContext(), Vals);
+}
+
MDNode *MDNode::getMostGenericFPMath(MDNode *A, MDNode *B) {
if (!A || !B)
return nullptr;
void Instruction::setAAMetadata(const AAMDNodes &N) {
setMetadata(LLVMContext::MD_tbaa, N.TBAA);
+ setMetadata(LLVMContext::MD_alias_scope, N.Scope);
+ setMetadata(LLVMContext::MD_noalias, N.NoAlias);
}
MDNode *Instruction::getMetadataImpl(unsigned KindID) const {