[VPlan] Add VPInst::getNumOperandsForOpcode, use to verify in ctor (NFC) (#142284)

Add a new getNumOperandsForOpcode helper to determine the number of
operands from the opcode. For now, it is used to verify the number
operands at VPInstruction construction.

It returns -1 for a few opcodes where the number of operands cannot be
determined (GEP, Switch, PHI, Call).

This can also be used in a follow-up to determine if a VPInstruction is
masked based on the number of arguments.

PR: https://github.com/llvm/llvm-project/pull/142284
GitOrigin-RevId: c3e25e7fc463932d763a0405e8d44151e8679b66
3 files changed