Skip to content

Commit

Permalink
Merge branch 'master' into refactor-pre-mmtk
Browse files Browse the repository at this point in the history
  • Loading branch information
udesou authored Aug 29, 2024
2 parents 6b4d608 + cebfd7b commit b2290d3
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 11 deletions.
9 changes: 6 additions & 3 deletions base/compiler/ssair/slot2ssa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ function fixup_slot!(ir::IRCode, ci::CodeInfo, idx::Int, slot::Int, @nospecializ
insert_node!(ir, idx, NewInstruction(
Expr(:throw_undef_if_not, ci.slotnames[slot], false), Any))
return UNDEF_TOKEN
elseif has_flag(ir.stmts[idx], IR_FLAG_NOTHROW)
# if the `isdefined`-ness of this slot is guaranteed by abstract interpretation,
# there is no need to form a `:throw_undef_if_not`
elseif def_ssa !== true
insert_node!(ir, idx, NewInstruction(
Expr(:throw_undef_if_not, ci.slotnames[slot], def_ssa), Any))
Expand Down Expand Up @@ -153,12 +156,12 @@ end

function fixup_uses!(ir::IRCode, ci::CodeInfo, code::Vector{Any}, uses::Vector{Int}, slot::Int, @nospecialize(ssa))
for use in uses
code[use] = fixemup!(x::SlotNumber->slot_id(x)==slot, stmt::SlotNumber->(ssa, true), ir, ci, use, code[use])
code[use] = fixemup!(x::SlotNumber->slot_id(x)==slot, ::SlotNumber->Pair{Any,Any}(ssa, true), ir, ci, use, code[use])
end
end

function rename_uses!(ir::IRCode, ci::CodeInfo, idx::Int, @nospecialize(stmt), renames::Vector{Pair{Any, Any}})
return fixemup!(stmt::SlotNumber->true, stmt::SlotNumber->renames[slot_id(stmt)], ir, ci, idx, stmt)
return fixemup!(::SlotNumber->true, x::SlotNumber->renames[slot_id(x)], ir, ci, idx, stmt)
end

# maybe use expr_type?
Expand Down Expand Up @@ -656,7 +659,7 @@ function construct_ssa!(ci::CodeInfo, ir::IRCode, sv::OptimizationState,
visited = BitSet()
new_nodes = ir.new_nodes
@timeit "SSA Rename" while !isempty(worklist)
(item::Int, pred, incoming_vals) = pop!(worklist)
(item, pred, incoming_vals) = pop!(worklist)
if sv.bb_vartables[item] === nothing
continue
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
70878dd96911d6960537dfee2a820d98
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
87d2bdc6c85cbbce5302aab8ffe92fc542c9c71a396844fcc04c0416be059b00298b4816ab5e5491dbf865660a3a6152f1c245875a1ec75fb49b4c7ba0d303d8

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d992a5c629199747d68baa1593a7c37d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
27ea738dbc4db8e4a02b00fbbdc4e2047906fe0561dd4c7f9e5ce5ea9b0b7b8ef9e29234f8e435deaa6cb3e29861130b06cb0da11118c40d78f4c475ac48db3f

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion stdlib/Downloads.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOWNLOADS_BRANCH = master
DOWNLOADS_SHA1 = a9d274ff6588cc5dbfa90e908ee34c2408bab84a
DOWNLOADS_SHA1 = 1061ecc377a053fce0df94e1a19e5260f7c030f5
DOWNLOADS_GIT_URL := https://github.com/JuliaLang/Downloads.jl.git
DOWNLOADS_TAR_URL = https://api.github.com/repos/JuliaLang/Downloads.jl/tarball/$1
2 changes: 1 addition & 1 deletion stdlib/Pkg.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PKG_BRANCH = master
PKG_SHA1 = d1d2fc986e7249909b450979acc4d359aacfc88e
PKG_SHA1 = 43e7849ce37545493d0da3226cd7449f5f88563e
PKG_GIT_URL := https://github.com/JuliaLang/Pkg.jl.git
PKG_TAR_URL = https://api.github.com/repos/JuliaLang/Pkg.jl/tarball/$1
8 changes: 6 additions & 2 deletions test/compiler/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6051,7 +6051,7 @@ end |> Core.Compiler.is_nothrow
end |> Core.Compiler.is_nothrow

# refine `undef` information from `@isdefined` check
@test Base.infer_effects((Bool,Int)) do c, x
function isdefined_nothrow(c, x)
local val
if c
val = x
Expand All @@ -6060,7 +6060,11 @@ end |> Core.Compiler.is_nothrow
return val
end
return zero(Int)
end |> Core.Compiler.is_nothrow
end
@test Core.Compiler.is_nothrow(Base.infer_effects(isdefined_nothrow, (Bool,Int)))
@test !any(first(only(code_typed(isdefined_nothrow, (Bool,Int)))).code) do @nospecialize x
Meta.isexpr(x, :throw_undef_if_not)
end

# End to end test case for the partially initialized struct with `PartialStruct`
@noinline broadcast_noescape1(a) = (broadcast(identity, a); nothing)
Expand Down

0 comments on commit b2290d3

Please sign in to comment.