Skip to content

Conversation

AmrDeveloper
Copy link
Member

Currently, in the case of an empty try block, we emit tryOp in scope and revisit the catchers, and in the lowering pass, we have a check to delete empty scopes, but we end up with scopes that contains cir.yeild or an unconditioned jump to another scope which will not be deleted, also for catchers we emits globals for type info.

But we can already ignore the try-catch statement if the try block is empty, because that means also all catchers are dead code, which will lead to not emitting any scopes that we know will be removed later and also not emitting any unnecessary type info

Example of current emitted IR: https://godbolt.org/z/5d3jEe5K8

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