Skip to content

Commit 197b56d

Browse files
committed
Fixup merge mishap
1 parent 3e6b02c commit 197b56d

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
531531
void visitCallStackMetadata(MDNode *MD);
532532
void visitMemProfMetadata(Instruction &I, MDNode *MD);
533533
void visitCallsiteMetadata(Instruction &I, MDNode *MD);
534+
void visitCalleeTypeMetadata(Instruction &I, MDNode *MD);
534535
void visitDIAssignIDMetadata(Instruction &I, MDNode *MD);
535536
void visitMMRAMetadata(Instruction &I, MDNode *MD);
536537
void visitAnnotationMetadata(MDNode *Annotation);
@@ -5203,6 +5204,33 @@ void Verifier::visitCallsiteMetadata(Instruction &I, MDNode *MD) {
52035204
visitCallStackMetadata(MD);
52045205
}
52055206

5207+
static inline bool isConstantIntMetadataOperand(const Metadata *MD) {
5208+
if (auto *VAL = dyn_cast<ValueAsMetadata>(MD))
5209+
return isa<ConstantInt>(VAL->getValue());
5210+
return false;
5211+
}
5212+
5213+
void Verifier::visitCalleeTypeMetadata(Instruction &I, MDNode *MD) {
5214+
Check(isa<CallBase>(I), "!callee_type metadata should only exist on calls",
5215+
&I);
5216+
for (Metadata *Op : MD->operands()) {
5217+
Check(isa<MDNode>(Op),
5218+
"The callee_type metadata must be a list of type metadata nodes", Op);
5219+
auto *TypeMD = cast<MDNode>(Op);
5220+
Check(TypeMD->getNumOperands() == 2,
5221+
"Well-formed generalized type metadata must contain exactly two "
5222+
"operands",
5223+
Op);
5224+
Check(isConstantIntMetadataOperand(TypeMD->getOperand(0)) &&
5225+
mdconst::extract<ConstantInt>(TypeMD->getOperand(0))->isZero(),
5226+
"The first operand of type metadata for functions must be zero", Op);
5227+
Check(TypeMD->hasGeneralizedMDString(),
5228+
"Only generalized type metadata can be part of the callee_type "
5229+
"metadata list",
5230+
Op);
5231+
}
5232+
}
5233+
52065234
void Verifier::visitAnnotationMetadata(MDNode *Annotation) {
52075235
Check(isa<MDTuple>(Annotation), "annotation must be a tuple");
52085236
Check(Annotation->getNumOperands() >= 1,
@@ -5480,6 +5508,9 @@ void Verifier::visitInstruction(Instruction &I) {
54805508
if (MDNode *MD = I.getMetadata(LLVMContext::MD_callsite))
54815509
visitCallsiteMetadata(I, MD);
54825510

5511+
if (MDNode *MD = I.getMetadata(LLVMContext::MD_callee_type))
5512+
visitCalleeTypeMetadata(I, MD);
5513+
54835514
if (MDNode *MD = I.getMetadata(LLVMContext::MD_DIAssignID))
54845515
visitDIAssignIDMetadata(I, MD);
54855516

llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,8 @@ bool AMDGPUCallLowering::lowerReturn(MachineIRBuilder &B, const Value *Val,
385385
else if (!lowerReturnVal(B, Val, VRegs, Ret))
386386
return false;
387387

388-
if (IsWholeWave) {
388+
if (IsWholeWave)
389389
addOriginalExecToReturn(B.getMF(), Ret);
390-
}
391390

392391
// TODO: Handle CalleeSavedRegsViaCopy.
393392

0 commit comments

Comments
 (0)