Skip to content
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

[CIR][CodeGen] Adds SwitchOp flattening #549

Merged
merged 9 commits into from
Apr 22, 2024

Conversation

gitoleg
Copy link
Collaborator

@gitoleg gitoleg commented Apr 18, 2024

This PR adds flattening for SwitchOp. Despite of the previous PRs, here we have to introduce an operation for the flattening, since later we'll need to create llvm.switch in the lowering.
So cir.flat.switch is a new operation, which barely copied from the dialect. I added several tests as well.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Awesome, just need fixing couple of cosmetic issues and I'll land

@@ -3539,6 +3539,45 @@ def IsConstantOp : CIR_Op<"is_constant", [Pure]> {
}];
}


def CIR_FlatSwitchOp : CIR_Op<"flat.switch", [AttrSizedOperandSegments, Terminator]> {
Copy link
Member

Choose a reason for hiding this comment

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

CIR_FlatSwitchOp -> SwitchFlatOp
flat.switch -> cir.switch.flat

clang/include/clang/CIR/Dialect/IR/CIROps.td Outdated Show resolved Hide resolved
@gitoleg
Copy link
Collaborator Author

gitoleg commented Apr 19, 2024

@bcardosolopes done!

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Still renaming to be done

@@ -3604,6 +3604,45 @@ def IsConstantOp : CIR_Op<"is_constant", [Pure]> {
}];
}


def CIR_SwitchFlatOp : CIR_Op<"switch.flat", [AttrSizedOperandSegments, Terminator]> {
Copy link
Member

Choose a reason for hiding this comment

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

CIR_SwitchFlatOp -> SwitchFlatOp, not sure why you are prefixing it with CIR_, we don't do that unless it's a tablegen class thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bcardosolopes my bad( fixed!

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

LGTM

@bcardosolopes bcardosolopes merged commit bfe1c91 into llvm:main Apr 22, 2024
6 checks passed
@gitoleg gitoleg mentioned this pull request Apr 26, 2024
lanza pushed a commit that referenced this pull request Apr 29, 2024
This PR adds flattening for `SwitchOp`. Despite of the previous PRs,
here we have to introduce an operation for the flattening, since later
we'll need to create `llvm.switch` in the lowering.
So `cir.flat.switch` is a new operation, which barely copied from the
dialect. I added several tests as well.
lanza pushed a commit that referenced this pull request Apr 29, 2024
This PR adds flattening for `SwitchOp`. Despite of the previous PRs,
here we have to introduce an operation for the flattening, since later
we'll need to create `llvm.switch` in the lowering.
So `cir.flat.switch` is a new operation, which barely copied from the
dialect. I added several tests as well.
lanza pushed a commit that referenced this pull request Apr 29, 2024
This PR adds flattening for `SwitchOp`. Despite of the previous PRs,
here we have to introduce an operation for the flattening, since later
we'll need to create `llvm.switch` in the lowering.
So `cir.flat.switch` is a new operation, which barely copied from the
dialect. I added several tests as well.
bruteforceboy pushed a commit to bruteforceboy/clangir that referenced this pull request Oct 2, 2024
This PR adds flattening for `SwitchOp`. Despite of the previous PRs,
here we have to introduce an operation for the flattening, since later
we'll need to create `llvm.switch` in the lowering.
So `cir.flat.switch` is a new operation, which barely copied from the
dialect. I added several tests as well.
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
This PR adds flattening for `SwitchOp`. Despite of the previous PRs,
here we have to introduce an operation for the flattening, since later
we'll need to create `llvm.switch` in the lowering.
So `cir.flat.switch` is a new operation, which barely copied from the
dialect. I added several tests as well.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
This PR adds flattening for `SwitchOp`. Despite of the previous PRs,
here we have to introduce an operation for the flattening, since later
we'll need to create `llvm.switch` in the lowering.
So `cir.flat.switch` is a new operation, which barely copied from the
dialect. I added several tests as well.
lanza pushed a commit that referenced this pull request Nov 5, 2024
This PR adds flattening for `SwitchOp`. Despite of the previous PRs,
here we have to introduce an operation for the flattening, since later
we'll need to create `llvm.switch` in the lowering.
So `cir.flat.switch` is a new operation, which barely copied from the
dialect. I added several tests as well.
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