diff --git a/base/compiler/optimize.jl b/base/compiler/optimize.jl index e2ef24a64c620..d83a7da62dafc 100644 --- a/base/compiler/optimize.jl +++ b/base/compiler/optimize.jl @@ -564,16 +564,16 @@ function ipo_dataflow_analysis!(interp::AbstractInterpreter, ir::IRCode, result: bstmt = ir[barg][:stmt] isexpr(bstmt, :boundscheck) || return false # If IR_FLAG_INBOUNDS is already set, no more conditional ub - (length(bstmt.args) != 0 && bstmt.args[1] === false) && return false + (!isempty(bstmt.args) && bstmt.args[1] === false) && return false any_conditional_ub = true return true end function scan_non_dataflow_flags!(inst::Instruction) flag = inst[:flag] - all_effect_free &= (flag & IR_FLAG_EFFECT_FREE) != 0 - all_nothrow &= (flag & IR_FLAG_NOTHROW) != 0 - if (flag & IR_FLAG_NOUB) == 0 + all_effect_free &= !iszero(flag & IR_FLAG_EFFECT_FREE) + all_nothrow &= !iszero(flag & IR_FLAG_NOTHROW) + if iszero(flag & IR_FLAG_NOUB) if !is_conditional_noub(inst) all_noub = false end @@ -582,7 +582,7 @@ function ipo_dataflow_analysis!(interp::AbstractInterpreter, ir::IRCode, result: function scan_inconsistency!(inst::Instruction, idx::Int) flag = inst[:flag] - stmt_inconsistent = (flag & IR_FLAG_CONSISTENT) == 0 + stmt_inconsistent = iszero(flag & IR_FLAG_CONSISTENT) stmt = inst[:stmt] # Special case: For getfield, we allow inconsistency of the :boundscheck argument if is_getfield_with_boundscheck_arg(inst) @@ -606,7 +606,7 @@ function ipo_dataflow_analysis!(interp::AbstractInterpreter, ir::IRCode, result: return stmt_inconsistent end - function scan_stmt!(inst, idx, lstmt, bb) + function scan_stmt!(inst::Instruction, idx::Int, lstmt::Int, bb::Int) stmt = inst[:inst] flag = inst[:flag] diff --git a/base/compiler/ssair/irinterp.jl b/base/compiler/ssair/irinterp.jl index 608fe4d915c6c..da3ff45bea4ab 100644 --- a/base/compiler/ssair/irinterp.jl +++ b/base/compiler/ssair/irinterp.jl @@ -217,7 +217,7 @@ function BBScanner(ir::IRCode) return BBScanner(ir, bb_ip) end -function scan!(callback, scanner::BBScanner, forwards_only::Bool) +function scan!(@specialize(callback), scanner::BBScanner, forwards_only::Bool) (; bb_ip, ir) = scanner bbs = ir.cfg.blocks while !isempty(bb_ip) @@ -235,7 +235,7 @@ function scan!(callback, scanner::BBScanner, forwards_only::Bool) end function populate_def_use_map!(tpdum::TwoPhaseDefUseMap, scanner::BBScanner) - scan!(scanner, false) do inst, idx, lstmt, bb + scan!(scanner, false) do inst::Instruction, idx::Int, lstmt::Int, bb::Int for ur in userefs(inst) val = ur[] if isa(val, SSAValue) @@ -262,7 +262,7 @@ function _ir_abstract_constant_propagation(interp::AbstractInterpreter, irsv::IR # Fast path: Scan both use counts and refinement in one single pass of # of the instructions. In the absence of backedges, this will # converge. - completed_scan = scan!(scanner, true) do inst, idx, lstmt, bb + completed_scan = scan!(scanner, true) do inst::Instruction, idx::Int, lstmt::Int, bb::Int irsv.curridx = idx stmt = ir.stmts[idx][:inst] typ = ir.stmts[idx][:type] @@ -315,7 +315,7 @@ function _ir_abstract_constant_propagation(interp::AbstractInterpreter, irsv::IR stmt_ip = BitSetBoundedMinPrioritySet(length(ir.stmts)) # Slow Path Phase 1.A: Complete use scanning - scan!(scanner, false) do inst, idx, lstmt, bb + scan!(scanner, false) do inst::Instruction, idx::Int, lstmt::Int, bb::Int irsv.curridx = idx stmt = inst[:inst] flag = inst[:flag] diff --git a/base/compiler/typeinfer.jl b/base/compiler/typeinfer.jl index f4ea69b310415..e4f143e0c75b6 100644 --- a/base/compiler/typeinfer.jl +++ b/base/compiler/typeinfer.jl @@ -464,7 +464,6 @@ function adjust_effects(ipo_effects::Effects, def::Method) return ipo_effects end - function adjust_effects(sv::InferenceState) ipo_effects = sv.ipo_effects @@ -554,7 +553,6 @@ function finish(me::InferenceState, interp::AbstractInterpreter) me.result.result = bestguess me.ipo_effects = me.result.ipo_effects = adjust_effects(me) - if limited_ret # a parent may be cached still, but not this intermediate work: # we can throw everything else away now