-
Couldn't load subscription status.
- Fork 15k
[CIR] Upstream the CatchParamOp #165110
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
Open
AmrDeveloper
wants to merge
4
commits into
llvm:main
Choose a base branch
from
AmrDeveloper:cir_exception_catch_param
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+211
−0
Open
[CIR] Upstream the CatchParamOp #165110
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // RUN: cir-opt %s -verify-diagnostics -split-input-file | ||
|
|
||
AmrDeveloper marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| !s32i = !cir.int<s, 32> | ||
| !void = !cir.void | ||
|
|
||
| module { | ||
|
|
||
| cir.func dso_local @catch_param_without_kind_and_without_try_scope() { | ||
| // expected-error @below {{'cir.catch_param' op without 'kind' requires 'cir.try' surrounding scope}} | ||
| %0 = cir.catch_param -> !cir.ptr<!void> | ||
| cir.return | ||
| } | ||
|
|
||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| !s32i = !cir.int<s, 32> | ||
| !void = !cir.void | ||
|
|
||
| module { | ||
|
|
||
| cir.func private @division() -> !s32i | ||
| cir.func dso_local @catch_param_with_exception_ptr_but_without_kind() { | ||
| cir.scope { | ||
| cir.try { | ||
| %0 = cir.call @division() : () -> !s32i | ||
| cir.yield | ||
| } catch all { | ||
| %0 = cir.const #cir.ptr<null> : !cir.ptr<!void> | ||
| // expected-error @below {{'cir.catch_param' op needs 'begin' to work with exception pointer}} | ||
| %1 = cir.catch_param %0 -> !cir.ptr<!void> | ||
| cir.yield | ||
| } | ||
| } | ||
| cir.return | ||
| } | ||
|
|
||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| !s32i = !cir.int<s, 32> | ||
| !void = !cir.void | ||
|
|
||
| module { | ||
|
|
||
| cir.func private @division() -> !s32i | ||
| cir.func dso_local @catch_param_with_exception_ptr_but_with_end_kind() { | ||
| cir.scope { | ||
| cir.try { | ||
| %0 = cir.call @division() : () -> !s32i | ||
| cir.yield | ||
| } catch all { | ||
| %0 = cir.const #cir.ptr<null> : !cir.ptr<!void> | ||
| // expected-error @below {{'cir.catch_param' op needs 'begin' to work with exception pointer}} | ||
| %1 = cir.catch_param end %0 -> !cir.ptr<!void> | ||
| cir.yield | ||
| } | ||
| } | ||
| cir.return | ||
| } | ||
|
|
||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It might be worth expanding on how the two modes are used (one that assumes structured control and the other one for lower level lowering). An alternative design would be split this into two operations (let's see if others have any strong opinions here).