-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[mypyc] Merge yield_from_except_op #9660
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
Changes from all commits
be534dc
0c8693c
542f308
5b9f8aa
0aa0136
adc66a5
9218df2
72a10b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
AnalysisDict | ||
) | ||
from mypyc.ir.ops import ( | ||
BasicBlock, Branch, Value, RaiseStandardError, Unreachable, Environment, Register | ||
BasicBlock, Branch, Value, RaiseStandardError, Unreachable, Environment, Register, | ||
LoadAddress | ||
) | ||
from mypyc.ir.func_ir import FuncIR | ||
|
||
|
@@ -44,8 +45,13 @@ def split_blocks_at_uninits(env: Environment, | |
# If a register operand is not guaranteed to be | ||
# initialized is an operand to something other than a | ||
# check that it is defined, insert a check. | ||
|
||
# Note that for register operand in a LoadAddress op, | ||
# we should be able to use it without initialization | ||
# as we may need to use its address to update itself | ||
if (isinstance(src, Register) and src not in defined | ||
and not (isinstance(op, Branch) and op.op == Branch.IS_ERROR)): | ||
and not (isinstance(op, Branch) and op.op == Branch.IS_ERROR) | ||
and not isinstance(op, LoadAddress)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this? Add comment explaining this, since this is a bit surprising. I wonder if we can somehow get rid of this special case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need this because we are taking the address of an uninitialized object, the automatically inserted initialization check will produce incorrect code, leading the control flow directly to uninitialized error rather than the following load address and other ops. |
||
new_block, error_block = BasicBlock(), BasicBlock() | ||
new_block.error_handler = error_block.error_handler = cur_block.error_handler | ||
new_blocks += [error_block, new_block] | ||
|
Uh oh!
There was an error while loading. Please reload this page.