Skip to content

[TableGen] Use consistent field kind checking in getNumericKey. #83284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 29, 2024

Conversation

nvjle
Copy link
Contributor

@nvjle nvjle commented Feb 28, 2024

Fields GenericField::IsInstruction and GenericField::Enum can be simultaneously active for a given field. Methods compareBy and primaryRepresentation both order the checking of IsInstruction before GenericField::Enum. Do the same in getNumericKey for consistency.

Fields GenericField::IsInstruction and GenericField::Enum can be
simultaneously active for a given field.  Methods compareBy and
primaryRepresentation both order the checking of IsInstruction before
GenericField::Enum. Do the same in getNumericKey for consistency.
@nvjle
Copy link
Contributor Author

nvjle commented Feb 28, 2024

Hi @piotrAMD , I hope you could review this tiny patch as discussed in #80486 .

Copy link
Collaborator

@piotrAMD piotrAMD left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix!

Normally it would need a test case, but I wasn't able to come up with a reproducer myself and I realize it can be tricky.

Record *TheDef = Rec->getValueAsDef(Index.Fields[0].Name);
return Target->getInstrIntValue(TheDef);
} else if (Index.Fields[0].Enum) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: No need for else if after return, if is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.
Could I trouble you or @wangpc-pp to merge on my behalf? Thank you.

@wangpc-pp wangpc-pp merged commit be8f987 into llvm:main Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants