Skip to content

Commit ec793aa

Browse files
committed
[CodeGen] MachineVerifier to check early-clobber constraint
Currently MachineVerifier is missing verifying early-clobber operand constraint. The only other machine operand constraint - TiedTo is already verified.
1 parent b3b36d3 commit ec793aa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,13 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
23252325
report("Missing mayStore flag", MI);
23262326
}
23272327

2328+
// Verify earlyClobber def operand
2329+
if (MCID.getOperandConstraint(0, MCOI::EARLY_CLOBBER) != -1) {
2330+
if (!MI->getOperand(0).isReg())
2331+
report("Early clobber must be a register", MI);
2332+
if (!MI->getOperand(0).isEarlyClobber())
2333+
report("Missing earlyClobber flag", MI);
2334+
}
23282335
// Debug values must not have a slot index.
23292336
// Other instructions must have one, unless they are inside a bundle.
23302337
if (LiveInts) {

0 commit comments

Comments
 (0)