[PATCH] D74803: TableGen: Fix logic for default operands

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 07:55:42 PST 2020


simon_tatham added a comment.

I might as well admit my ignorance up front: despite having been the last person to touch this code, I don't really understand what the distinction is between a `CodeGenInstruction` and a `DAGInstruction` here, apart from the fact that one of them has an operand list that includes the outputs as well as the inputs.

As far as I can see, each `DAGInstruction` is built from a `CodeGenInstruction` by the loop in `CodeGenDAGPatterns::ParseInstructions()`, and it //looks// to me from reading that code as if the number of operands of the `DAGInstruction` should always be the same as `NumFixedOperands - NumResults` for the corresponding `CodeGenInstruction`, and the operand list is a copy of the same list of records. So without a test case or an existing example, I can't see how this change is making any difference at all.

I wrote this default-operand checking to use with the MVE instructions in the Arm backend. Certainly in that context it seems to make no difference which of these pieces of code is used: an instruction like `MVE_VADDi8`, for example, has three input operands in both of these views, with the last one being defaultable (even though it then consists of multiple sub-operands that show up as separate children of the DAG node).

Do you have an example of a case in which the code you're replacing gives different answers before and after this patch?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74803/new/

https://reviews.llvm.org/D74803





More information about the llvm-commits mailing list