-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SandboxIR] Implement SelectInst #99996
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
Conversation
I just realized I need to add some tests to exercise the |
if (auto *NewSI = dyn_cast<llvm::SelectInst>(NewV)) | ||
return Ctx.createSelectInst(NewSI); | ||
assert(isa<llvm::Constant>(NewV) && "Expected constant"); | ||
return Ctx.getOrCreateConstant(cast<llvm::Constant>(NewV)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a createCommon here too like ReturnInst to capture the duplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes.
{ | ||
// Check SelectInst::create() InsertAtEnd. | ||
auto *NewSel = cast<sandboxir::SelectInst>( | ||
sandboxir::SelectInst::create(Cond0, V0, V1, /*InsertAtEnd=*/BB, Ctx)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth checking *(BB->end())->getOpcodeName() == Select here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this is automatically handled by the .def
files, so it shouldn't normally be wrong. But yeah, at some point we should check this too.
It will be checked once we add tests for the dump()
functions for the whole class hierarchy in a future patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine after addressing some minor comments. Very similar to other instruction classes.
This patch implements sandboxir::SelectInst which mirrors llvm::SelectInst.
Summary: This patch implements sandboxir::SelectInst which mirrors llvm::SelectInst. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250785
This patch implements sandboxir::SelectInst which mirrors llvm::SelectInst.