-
Notifications
You must be signed in to change notification settings - Fork 128
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] Add initial support for __cxa_rethrow #1290
Conversation
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.
Overall this looks good, some minor change needed.
There are quite a number of differences: phi in the CIR version VS loading from %exn.slot in the OG, having multiple landing pads, etc.
Yes, we use block arguments for the slots, and don't unique landing pads (yet). We might stay with the former but fix the later.
The CIR version still seems reasonable to me, mostly because currently we are unable to replicate the exact behavior of the OG codegen. Again, I am very open to more discussions and suggestions here)
I think it's similar enough!
We just went over a rebase against upstream, apologies for the churn but please update your branch for this PR and force-push! |
309a87c
to
39e1a35
Compare
39e1a35
to
dfa69ed
Compare
ba03e3f
to
fa80c8c
Compare
8fffc61
to
2b4a28a
Compare
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.
Awesome, thanks!
@bcardosolopes thanks for approving! I am still a bit worried about the case where we ignore everything below the You mentioned that it is a bigger problem in CIR. So, I am just curious what will be to correct way to fix this? Is there something wrong with the approach using blocks? I can open a new PR or modify this, but I want to know the right way to approach this. |
I'm worried too, thanks for followin up with that!
A new PR would be great! Manipulating blocks sounds fine, we can go over specific concerns over reviews. |
This is the second part of [PR#1290](#1290), adding initial support for `__cxa_rethrow`. So, the last PR did not support statements that come after the `UnreachableOp` from the `rethrow`, we just ignored them, e.g: ``` struct S { S() {} }; void foo() { int r = 1; try { throw; S s; } catch (...) { ++r; } } ``` This PR fixes this. A few changes: - `rethrow` statements split their block into multiple blocks. - Tests with statements that come after the `rethrow` were added and old ones were modified. Concern: - The `ScopeOp` workaround still exists which I guess was one of the main concerns when we tried in the last PR. As usual, I am open to discussions on this and how to approach it better -:)
This PR adds an initial support for
__cxa_rethrow
, and one test that produces a rethrow.I am very open to suggestions regarding this PR, because I'm still a bit unsure if this replicates the original codegen properly. For example, using the test added, the OG CodeGen produces:
and the proposed CIR equivalent produces:
There are quite a number of differences:
phi
in the CIR version VS loading from%exn.slot
in the OG, having multiple landing pads, etc.The CIR version still seems reasonable to me, mostly because currently we are unable to replicate the exact behavior of the OG codegen. Again, I am very open to more discussions and suggestions here)