Skip to content

Commit

Permalink
[RISCV] Verify that policy operands only exist on instructions with t…
Browse files Browse the repository at this point in the history
…ied passthru operands

This is a non-trivial property relied upon by D135396. I wrote this to convince myself it was true.

Differential Revision: https://reviews.llvm.org/D135403
  • Loading branch information
preames committed Oct 6, 2022
1 parent 76ac3b8 commit 0275165
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Expand Up @@ -1266,6 +1266,15 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
ErrInfo = "policy operand w/o VL operand?";
return false;
}

// VecPolicy operands can only exist on instructions with passthru/merge
// arguments. Note that not all arguments with passthru have vec policy
// operands- some instructions have implicit policies.
unsigned UseOpIdx;
if (!MI.isRegTiedToUseOperand(0, &UseOpIdx)) {
ErrInfo = "policy operand w/o tied operand?";
return false;
}
}

return true;
Expand Down

0 comments on commit 0275165

Please sign in to comment.