Skip to content

[SandboxIR] Add ExtractValueInst. #106613

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
Aug 29, 2024
Merged

Conversation

slackito
Copy link
Collaborator

No description provided.

return From->getSubclassID() == ClassID::ExtractValue;
}

static Type *getIndexedType(Type *Agg, ArrayRef<unsigned> Idxs) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: It is not straight forward what this function does, so I would copy LLVM IR's comments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

EXPECT_EQ(sandboxir::ExtractValueInst::getIndexedType(
AggType, ArrayRef<unsigned>({1, 0})),
llvm::ExtractValueInst::getIndexedType(AggType,
ArrayRef<unsigned>({1, 0})));
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you have two checks for getIndexedType(), one that returns non-null and one that returns null. The reason is that once we migrate to sandboxir::Type the null case would need special treatment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a simple test for the nullptr case. Please take another look.

- Copy comment from llvm::ExtractValueInst::getIndexedType
- Add test case for getIndexedType returning nullptr
Copy link
Contributor

@vporpo vporpo left a comment

Choose a reason for hiding this comment

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

LG thanks!

@slackito slackito merged commit 1827086 into llvm:main Aug 29, 2024
6 of 7 checks passed
@slackito slackito deleted the sandboxir_extractvalueinst branch August 29, 2024 21:25
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.

2 participants