Skip to content

make union-split const-prop' test robust against future changes of th…#220

Merged
aviatesk merged 1 commit intomasterfrom
avi/unionconst
Aug 24, 2021
Merged

make union-split const-prop' test robust against future changes of th…#220
aviatesk merged 1 commit intomasterfrom
avi/unionconst

Conversation

@aviatesk
Copy link
Copy Markdown
Member

…e heuristics

JuliaLang/julia#41882 will enforce const-prop'
on getproperty calls, and so we will get const callsites for both
getproperty(::F32, ::Const(:val)) and getproperty(::FZero, ::Const(:val)).

struct F32
    val::Float32
    _v::Int
end
struct FZero end
Base.getproperty(::FZero, ::Symbol) = 0.0

find_callsites_by_ftt((Union{F32,FZero},); optimize = false) do f
    f.val
end

JuliaLang/julia#41889 will further change the
heuristic so that we don't constant-fold getproperty as far as the
result is already Const, but I don't think this PR is still worth to
have because I think we will try to make sure we constant prop'
getindex(::Const(::Tuple), ::Const).

…e heuristics

<JuliaLang/julia#41882> will enforce const-prop'
on `getproperty` calls, and so we will get const callsites for both
`getproperty(::F32, ::Const(:val))` and `getproperty(::FZero, ::Const(:val))`.
```julia
struct F32
    val::Float32
    _v::Int
end
struct FZero end
Base.getproperty(::FZero, ::Symbol) = 0.0

find_callsites_by_ftt((Union{F32,FZero},); optimize = false) do f
    f.val
end
```

<JuliaLang/julia#41889> will further change the
heuristic so that we don't constant-fold `getproperty` as far as the
result is already `Const`, but I don't think this PR is still worth to
have because I think we will try to make sure we constant prop'
`getindex(::Const(::Tuple), ::Const)`.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 23, 2021

Codecov Report

Merging #220 (8cd51c6) into master (4d02211) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #220   +/-   ##
=======================================
  Coverage   47.26%   47.26%           
=======================================
  Files           7        7           
  Lines         897      897           
=======================================
  Hits          424      424           
  Misses        473      473           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d02211...8cd51c6. Read the comment docs.

@aviatesk aviatesk merged commit 1f1c9e6 into master Aug 24, 2021
@aviatesk aviatesk deleted the avi/unionconst branch August 24, 2021 04:21
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