Skip to content

Conversation

@aviatesk
Copy link
Member

This PR backports #48583 and #48022. It should fix the test failure in the reduce test set.
xref: #48583 (comment)

staticfloat and others added 2 commits February 22, 2023 18:42
Previously, the effects system would ignore certain cases where
`GotoIfNot` nodes would be capable of throwing; this resulted in simple
examples such as the following being marked as `nothrow`:

```
julia> foo(x) = x > 0 ? x : 0
       Base.infer_effects(foo, (Missing,))
(+c,+e,+n,+t,+s,+m,+i)
```

With this change, we correctly notice when a `GotoIfNot` node is given a
non-`Bool` condition, annotate the basic block as possibly throwing, and
further end type inference if the condition is provably non-`Bool`.
I don't think there's any good reason to try to delete the statements
here. The very next thing we do is to convert to IRCode which drops
dead code anyway, so this just seems redundant. In addition, it
complicates Cthulhu-like analysis, which now has to track an extra
set of statement numbers.
@KristofferC KristofferC merged commit 912cda1 into backports-release-1.9 Feb 22, 2023
@KristofferC KristofferC deleted the avi/backport branch February 22, 2023 13:24
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.

5 participants