Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Aug 20, 2023
1 parent 1108186 commit 0aa6b47
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@ end
function abstract_call_method_with_const_args(interp::AbstractInterpreter,
result::MethodCallResult, @nospecialize(f), arginfo::ArgInfo, si::StmtInfo,
match::MethodMatch, sv::AbsIntState, invokecall::Union{Nothing,InvokeCall}=nothing)

if !const_prop_enabled(interp, sv, match)
return nothing
end
Expand Down
3 changes: 1 addition & 2 deletions base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ function ipo_dataflow_analysis!(interp::AbstractInterpreter, ir::IRCode, result:
return (cfg, domtree)
end


function scan_non_dataflow_flags!(flag)
all_effect_free &= (flag & IR_FLAG_EFFECT_FREE) != 0
all_nothrow &= (flag & IR_FLAG_NOTHROW) != 0
Expand Down Expand Up @@ -549,7 +548,7 @@ function ipo_dataflow_analysis!(interp::AbstractInterpreter, ir::IRCode, result:
end
end

return all_retpaths_consistent
return true
end
if !scan!(scan_stmt!, scanner, true)
if !all_retpaths_consistent
Expand Down
5 changes: 4 additions & 1 deletion base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,10 @@ function type_annotate!(interp::AbstractInterpreter, sv::InferenceState, run_opt
elseif ssavaluetypes[i] === Bottom
block = block_for_inst(sv.cfg, i)
cfg_delete_edge!(sv.cfg, block, block + 1)
cfg_delete_edge!(sv.cfg, block, block_for_inst(sv.cfg, expr.dest))
falsedest = block_for_inst(sv.cfg, expr.dest)
if falsedest != block + 1
cfg_delete_edge!(sv.cfg, block, falsedest)
end
expr = Expr(:call, Core.typeassert, expr.cond, Bool)
end
end
Expand Down
3 changes: 1 addition & 2 deletions test/compiler/effects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,7 @@ end |> Core.Compiler.is_foldable_nothrow
return 1
end |> Core.Compiler.is_foldable_nothrow

# TODO: Needs noub split
@test_broken Base.infer_effects(Tuple{Int64}) do i
@test Base.infer_effects(Tuple{Int64}) do i
@inbounds (1,2,3)[i]
end |> !Core.Compiler.is_noub

Expand Down
7 changes: 3 additions & 4 deletions test/compiler/invalidation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,14 @@ end
# we can avoid adding backedge even if the callee's return type is not the top
# when the return value is not used within the caller
begin take!(GLOBAL_BUFFER)

pr48932_callee_inferrable(x) = (print(GLOBAL_BUFFER, x); nothing)
pr48932_callee_inferrable(x) = (print(GLOBAL_BUFFER, x); Base.inferencebarrier(1)::Int)
pr48932_caller_unuse(x) = (pr48932_callee_inferrable(Base.inferencebarrier(x)); nothing)

# assert that type and effects information inferred from `pr48932_callee(::Any)` are the top
let rt = only(Base.return_types(pr48932_callee_inferrable, (Any,)))
@test rt === Nothing
@test rt === Int
effects = Base.infer_effects(pr48932_callee_inferrable, (Any,))
@test_broken Core.Compiler.Effects(effects; noinbounds=false) == Core.Compiler.Effects()
@test Core.Compiler.Effects(effects; noinbounds=false) == Core.Compiler.Effects()
end

# run inference on both `pr48932_caller` and `pr48932_callee`:
Expand Down

0 comments on commit 0aa6b47

Please sign in to comment.