Conversation
aviatesk
reviewed
Jun 20, 2022
| return is | ||
| end | ||
| function setindex!(is::InstructionStream, newval::AnySSAValue, idx::Int) | ||
| function setindex!(is::InstructionStream, newval::Union{AnySSAValue, Nothing}, idx::Int) |
Member
There was a problem hiding this comment.
This change seems unnecessary?
Member
Author
There was a problem hiding this comment.
This regressed at some point. It's the idiom for deleting and instruction so should work, but yes, it's mostly unrelated to this PR.
| end | ||
|
|
||
| function setindex!(x::IRCode, repl::Union{Instruction, AnySSAValue}, s::SSAValue) | ||
| function setindex!(x::IRCode, repl::Union{Instruction, Nothing, AnySSAValue}, s::SSAValue) |
| isa(stmt, Slot) && return (false, false) # Slots shouldn't occur in the IR at this point, but let's be defensive here | ||
| if isa(stmt, GlobalRef) | ||
| nothrow = isdefined(stmt.mod, stmt.name) | ||
| return (nothrow, nothrow) |
Member
There was a problem hiding this comment.
Suggested change
| return (nothrow, nothrow) | |
| return (nothrow && isconst(stmt.mod, stmt.name), nothrow) |
Member
Author
There was a problem hiding this comment.
This should keep doing what it did before, but probably the total in the comment is from and it should actually be effect_free. This code predates the clarification of those terms.
| eT ⊑ fT || return (false, false) | ||
| end | ||
| return true | ||
| return (true, true) |
Member
There was a problem hiding this comment.
Suggested change
| return (true, true) | |
| return (!ismutabletype(typ), true) |
aviatesk
reviewed
Jun 20, 2022
base/compiler/optimize.jl
Outdated
Comment on lines
193
to
195
| Returns a tuple of (total, nothrow) for a given statement. | ||
|
|
||
| Determine whether a `stmt` is "side-effect-free", i.e. may be removed if it has no uses. |
Member
There was a problem hiding this comment.
Suggested change
| Returns a tuple of (total, nothrow) for a given statement. | |
| Determine whether a `stmt` is "side-effect-free", i.e. may be removed if it has no uses. | |
| Returns a tuple of (total, nothrow) for a given statement. |
I added the flag in #45272, but didn't hook it up to the nothrow model. In the fullness of time, these should forwarded from inference and only recomputed if necessary, but for the moment, just make it work.
Member
|
sgtm |
pcjentsch
pushed a commit
to pcjentsch/julia
that referenced
this pull request
Aug 18, 2022
I added the flag in JuliaLang#45272, but didn't hook it up to the nothrow model. In the fullness of time, these should forwarded from inference and only recomputed if necessary, but for the moment, just make it work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added the flag in #45272, but didn't hook it up to the nothrow
model. In the fullness of time, these should forwarded from
inference and only recomputed if necessary, but for the moment,
just make it work.