-
Notifications
You must be signed in to change notification settings - Fork 175
[CIR][ThroughMLIR] Lower simple SwitchOp. #1871
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
base: main
Are you sure you want to change the base?
Conversation
| /// Create a pass for transforming CIR operations to more 'scf' dialect-friendly | ||
| /// forms. It rewrites operations that aren't supported by 'scf', such as breaks | ||
| /// and continues. | ||
| std::unique_ptr<mlir::Pass> createMLIRLoweringPreparePass(); |
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.
I'm a bit skeptical of having an MLIRLoweringPrepare pass that is separate from the existing LoweringPrepare pass. For one thing, "lowering through MLIR" is a very vague concept. The fact that you're mentioning scf as the target dialect here is good. I'd like to consider what's in LoweringPrepare to see if things can be reorganized in a more general way so anyone lowering to arbitrary dialects will be able to reason about what passes they need to run to prepare.
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.
I agree.
I'd expect lowering to SCF to be selected at LoweringPreparePass::runOnOperation() based using -fno-direct-lowering. You could still keep the implementation on a distinct file, but following Andy's suggestion of location
|
|
||
| namespace cir { | ||
|
|
||
| struct MLIRLoweringPrepare |
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.
This should probably be in the lib/CIR/Dialects/Transforms directory. That, of course, relates to my comment above about the focus of this pass.
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.
Thanks for the suggestion, file is moved to lib/CIR/Dialects/Transfrorms.
| /// Create a pass for transforming CIR operations to more 'scf' dialect-friendly | ||
| /// forms. It rewrites operations that aren't supported by 'scf', such as breaks | ||
| /// and continues. | ||
| std::unique_ptr<mlir::Pass> createMLIRLoweringPreparePass(); |
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.
I agree.
I'd expect lowering to SCF to be selected at LoweringPreparePass::runOnOperation() based using -fno-direct-lowering. You could still keep the implementation on a distinct file, but following Andy's suggestion of location
656da33 to
8892d4f
Compare
|
Please let me know when this is ready for review again |
Sure, this is one of the PR I am currently working on. Thanks for your patience 🤝 |
8acaf96 to
58135ea
Compare
`clang/lib/CIR/Dialect/Transforms`.
50b4a6a to
799bfb9
Compare
The PR 1742 contains too many conflicts with the main branch.
Got it re-patched to the current main branch.