NumberedMetadata[SlotNo] == nullptr)
return Error(MDList[i].Loc, "use of undefined metadata '!" +
Twine(SlotNo) + "'");
+ assert(!NumberedMetadata[SlotNo]->isFunctionLocal() &&
+ "Unexpected function-local metadata");
Inst->setMetadata(MDList[i].MDKind, NumberedMetadata[SlotNo]);
}
}
if (ParseMetadataListValue(ID, PFS))
return true;
assert(ID.Kind == ValID::t_MDNode);
+ if (ID.MDNodeVal->isFunctionLocal())
+ return TokError("unexpected function-local metadata");
Inst->setMetadata(MDK, ID.MDNodeVal);
} else {
unsigned NodeID = 0;
MDKindMap.find(Kind);
if (I == MDKindMap.end())
return Error(BitcodeError::InvalidID);
- Value *Node = MDValueList.getValueFwdRef(Record[i+1]);
- Inst->setMetadata(I->second, cast<MDNode>(Node));
+ MDNode *Node = cast<MDNode>(MDValueList.getValueFwdRef(Record[i+1]));
+ if (Node->isFunctionLocal())
+ // Drop the attachment. This used to be legal, but there's no
+ // upgrade path.
+ break;
+ Inst->setMetadata(I->second, Node);
if (I->second == LLVMContext::MD_tbaa)
InstsWithTBAATag.push_back(Inst);
}
// Handle the case when we're adding/updating metadata on an instruction.
if (Node) {
+ assert(!Node->isFunctionLocal() &&
+ "Function-local metadata cannot be attached to instructions");
LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
assert(!Info.empty() == hasMetadataHashEntry() &&
"HasMetadata bit is wonked");
call void @llvm.zonk(metadata !1, i64 0, metadata !1)
store i32 0, i32* null, !whatever !0, !whatever_else !{}, !more !{metadata !"hello"}
store i32 0, i32* null, !whatever !{metadata !"hello", metadata !1, metadata !{}, metadata !2}
- ret void, !whatever !{i32 %x}
+ ret void
}
declare void @llvm.zonk(metadata, i64, metadata) nounwind readnone
; RUN: llvm-link %s %p/metadata-b.ll -S -o - | FileCheck %s
; CHECK: define void @foo(i32 %a)
-; CHECK: ret void, !attach !0, !also !{i32 %a}
+; CHECK: ret void, !attach !0
; CHECK: define void @goo(i32 %b)
-; CHECK: ret void, !attach !1, !and !{i32 %b}
+; CHECK: ret void, !attach !1
; CHECK: !0 = metadata !{i32 524334, void (i32)* @foo}
; CHECK: !1 = metadata !{i32 524334, void (i32)* @goo}
define void @foo(i32 %a) nounwind {
entry:
- ret void, !attach !0, !also !{ i32 %a }
+ ret void, !attach !0
}
!0 = metadata !{i32 524334, void (i32)* @foo}
define void @goo(i32 %b) nounwind {
entry:
- ret void, !attach !0, !and !{ i32 %b }
+ ret void, !attach !0
}
!0 = metadata !{i32 524334, void (i32)* @goo}