Skip to content

Commit 4724c6e

Browse files
committed
Move verifier down to parent change.
Created using spr 1.3.6-beta.1
2 parents 55ea3e2 + 175b5f1 commit 4724c6e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

llvm/include/llvm/IR/Metadata.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,12 @@ class MDNode : public Metadata {
12591259
bool isReplaceable() const { return isTemporary() || isAlwaysReplaceable(); }
12601260
bool isAlwaysReplaceable() const { return getMetadataID() == DIAssignIDKind; }
12611261

1262+
bool hasGeneralizedMDString() const {
1263+
if (getNumOperands() < 2 || !isa<MDString>(getOperand(1)))
1264+
return false;
1265+
return cast<MDString>(getOperand(1))->getString().ends_with(".generalized");
1266+
}
1267+
12621268
unsigned getNumTemporaryUses() const {
12631269
assert(isTemporary() && "Only for temporaries");
12641270
return Context.getReplaceableUses()->getNumUses();

llvm/lib/IR/Verifier.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5060,8 +5060,7 @@ void Verifier::visitCalleeTypeMetadata(Instruction &I, MDNode *MD) {
50605060
&I);
50615061
for (const auto &Op : MD->operands()) {
50625062
auto *TypeMD = cast<MDNode>(Op.get());
5063-
MDString *TypeIdStr = cast<MDString>(TypeMD->getOperand(1));
5064-
Check(TypeIdStr->getString().ends_with(".generalized"),
5063+
Check(TypeMD->hasGeneralizedMDString(),
50655064
"Invalid \"callee_type\" type identifier", &I);
50665065
}
50675066
}

0 commit comments

Comments
 (0)