hasAllNBitUsers() should be modified to contain new instruction?

I have implemented some instructions that use, in their PatFrags, hasAllNBitUsers(). Is it necessary to update that function to handle these cases? Does it need to be updated only for handwritten RISC-V assembly? I am asking this last question because it is impossible for the new instruction to be a user because it is after the current instruction in program order and thus, not yet pattern matched. Also, why isn’t the if statement:

if (!N0.isMachineOpcode())

an assertion instead?

You’ll presumably need to update the assertion to permit your instruction, and depending on what your instruction does you may want to update the opcodes it knows about, but the latter is an optimisation only and not required for correctness. So “it depends”.

Assembly doesn’t go through instruction selection or optimisation passes, what you write is what you get (with very few exceptions).

I don’t know whether that’s because it can be legitimately called in such cases, because it’s designed to be able to be in future or just overly-conservative coding. I don’t see anything obvious in the review that introduced the function talking about why it was done that way.