-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
codegen: add handling for undefined phinode values #45155
Conversation
I pushed a test to this. |
test/compiler/codegen.jl
Outdated
|
||
mktemp() do f_44501, _ | ||
write(f_44501, str_44501) | ||
@test success(`$(Base.julia_cmd()) --startup-file=no -O0 $f_44501`) |
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.
why is this launching a process to run a test? we don't do that normally
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.
Because it needs -O0
to repro.
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.
That generally just means it is a bad test, but you don't need a new process for that either as there is Base.Experimental.@compiler_options optimize=0
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's the test I have for now. I'll try with the option instead, good idea.
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.
I tried with that but it didn't repro with it. Feel free to change/remove this test.
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.
Ultimately our ssa-conversion optimization pass is doing a bad job here, so this test is not expected to be reliable. We don't really have a good way to unit-test just the codegen part however for weird IR forms like this.
The optimization pass often uses values for phi values (and thus by extension, also for pi, phic and upsilon values) that are invalid. We make sure that these have a null pointer, so that we can detect that case at runtime (at the cost of slightly worse code generation for them), but it means we need to be very careful to check for that. This is identical to #39747, which added the equivalent code to the other side of the conditional there, but missed some additional relevant, but rare, cases that are observed to be possible. The `emit_isa_and_defined` is derived from the LLVM name for this operation: `isa_and_nonnull<T>`. Secondly, we also optimize `emit_unionmove` to change a bad IR case to a better IR form. Fix #44501
The optimization pass often uses values for phi values (and thus by extension, also for pi, phic and upsilon values) that are invalid. We make sure that these have a null pointer, so that we can detect that case at runtime (at the cost of slightly worse code generation for them), but it means we need to be very careful to check for that. This is identical to #39747, which added the equivalent code to the other side of the conditional there, but missed some additional relevant, but rare, cases that are observed to be possible. The `emit_isa_and_defined` is derived from the LLVM name for this operation: `isa_and_nonnull<T>`. Secondly, we also optimize `emit_unionmove` to change a bad IR case to a better IR form. Fix #44501 (cherry picked from commit 72b80e2)
The optimization pass often uses values for phi values (and thus by extension, also for pi, phic and upsilon values) that are invalid. We make sure that these have a null pointer, so that we can detect that case at runtime (at the cost of slightly worse code generation for them), but it means we need to be very careful to check for that. This is identical to #39747, which added the equivalent code to the other side of the conditional there, but missed some additional relevant, but rare, cases that are observed to be possible. The `emit_isa_and_defined` is derived from the LLVM name for this operation: `isa_and_nonnull<T>`. Secondly, we also optimize `emit_unionmove` to change a bad IR case to a better IR form. Fix #44501 (cherry picked from commit 72b80e2)
The optimization pass often uses values for phi values (and thus by
extension, also for pi, phic and upsilon values) that are invalid. We
make sure that these have a null pointer, so that we can detect that
case at runtime (at the cost of slightly worse code generation for
them), but it means we need to be very careful to check for that.
This is identical to #39747, which added the equivalent code to the
other side of the conditional there, but missed some additional
relevant, but rare, cases that are observed to be possible.
The
emit_isa_and_defined
is derived from the LLVM name for thisoperation:
isa_and_nonnull<T>
.Secondly, we also optimize
emit_unionmove
to change a bad IR case to abetter IR form.
Fix #44501