Issue 173576
Summary Conflicting Behavior In Verifying the Number of Operands in `llvm::SIInstrInfo` and the `llvm::MachineVerifier`
Labels new issue
Assignees
Reporter matinraayai
    I was investigating if it is legal to append additional metadata operands to the end of the explicit operand list of a machine instruction. [The code in `llvm::MachineVerifier`](https://github.com/llvm/llvm-project/blob/30c6bbe8d3650a061909fb58085416f2411aa123/llvm/lib/CodeGen/MachineVerifier.cpp#L2631-L2634) seems to indicate that it should be legal, since metadata counts as a valid excess operand:
https://github.com/llvm/llvm-project/blob/30c6bbe8d3650a061909fb58085416f2411aa123/llvm/include/llvm/CodeGen/MachineOperand.h#L477-L483

In the `llvm::SIInstrInfo::verifyInstruction` method, however, there is a strict check that if the number of explicit operands isn't the same as the number of operands in the MCID, then it is an invalid instruction:
https://github.com/llvm/llvm-project/blob/30c6bbe8d3650a061909fb58085416f2411aa123/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp#L5074-L5079

So far I haven't been able to find anything similar to this check in any other in-tree target. I think the check in `llvm::SIInstrInfo` is incorrect and has to be removed from the AMDGPU backend.

@arsenm @shiltian 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to