[llvm] [TableGen] Improvements to Named operands in InstrInfoEmitter (PR #124960)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 2 09:32:05 PST 2025


jurahul wrote:

> Hi @jurahul , We are also using OPERAND_LAST in downstream branch and we noticed that it was/is accessing first element from next row in OperandMap 2dim table. Proposal: #125424
> 
> ```
> namespace llvm::AMDGPU::OpName {
> enum {
>   a16 = 0,
>  ...
>   OPERAND_LAST = 115,
> 
> int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx) {
>   static constexpr int8_t OperandMap[][115] = {
> ```

I'd say passing OPERAND_LAST is an error into this function. It worked because it wasn't actually the last enum in many cases. 

https://github.com/llvm/llvm-project/pull/124960


More information about the llvm-commits mailing list