Skip to content

Conversation

tlively
Copy link
Member

@tlively tlively commented Apr 10, 2024

We previously printed the size of the tuple operand as the arity, but that
printed 1 when the operand is unreachable. We don't allow our text input to
use 1 as the arity, so don't print it, either. Instead, print the smallest
valid arity, 2, in this case.

We previously printed the size of the tuple operand as the arity, but that printed `1` when the operand is unreachable. We don't allow our text input to use `1` as the arity, so don't print it, either. Instead, print the smallest valid arity, `2`, in this case.
@tlively tlively requested a review from kripken April 10, 2024 23:46
@tlively
Copy link
Member Author

tlively commented Apr 10, 2024

// not a valid tuple size. The size we print mostly doesn't matter if the
// tuple is unreachable, but it does have to be valid.
auto arity = curr->tuple->type.size();
arity = arity < 2 ? 2 : arity;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
arity = arity < 2 ? 2 : arity;
arity = std::min(arity, 2);
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (tuple.extract 1 1
;; CHECK-NEXT: (tuple.extract 2 1
;; CHECK-NEXT: (local.tee $tuple
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this depend on the type of $tuple, which happens to be of size 2? That is, if line 571 changed to have 17 items in the tuple, would this still validate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would still validate because we do not store the expected arity of TupleExtract in the IR, so the validator would not know what the expected arity is, just that the tuple value is unreachable.

@tlively tlively merged commit adea6e0 into main Apr 11, 2024
@tlively tlively deleted the tuple-extract-valid-arity branch April 11, 2024 16:22
@gkdn gkdn mentioned this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants