Skip to content

Commit

Permalink
remove a bit of unused or unnecessary code in base/compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jul 8, 2018
1 parent e8dd411 commit b6f9244
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 46 deletions.
4 changes: 1 addition & 3 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -840,9 +840,7 @@ function abstract_eval(@nospecialize(e), vtypes::VarTable, sv::InferenceState)
return abstract_eval_ssavalue(e::SSAValue, sv.src)
elseif isa(e, Slot)
return vtypes[slot_id(e)].typ
elseif isa(e, Symbol)
return abstract_eval_global(sv.mod, e)
elseif isa(e,GlobalRef)
elseif isa(e, GlobalRef)
return abstract_eval_global(e.mod, e.name)
end

Expand Down
22 changes: 0 additions & 22 deletions base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ const IR_FLAG_INBOUNDS = 0x01
# known affect-free calls (also effect-free)
const _PURE_BUILTINS = Any[tuple, svec, fieldtype, apply_type, ===, isa, typeof, UnionAll, nfields]

# known effect-free calls (might not be affect-free)
const _PURE_BUILTINS_VOLATILE = Any[getfield, arrayref, isdefined, Core.sizeof]

const TOP_TUPLE = GlobalRef(Core, :tuple)

#########
Expand Down Expand Up @@ -256,17 +253,6 @@ function is_pure_intrinsic_optim(f::IntrinsicFunction)
f === Intrinsics.cglobal) # cglobal throws an error for symbol-not-found
end

function is_pure_builtin(@nospecialize(f))
if isa(f, IntrinsicFunction)
return is_pure_intrinsic_optim(f)
elseif isa(f, Builtin)
return (contains_is(_PURE_BUILTINS, f) ||
contains_is(_PURE_BUILTINS_VOLATILE, f))
else
return f === return_type
end
end

## Computing the cost of a function body

# saturating sum (inputs are nonnegative), prevents overflow with typemax(Int) below
Expand Down Expand Up @@ -384,14 +370,6 @@ function is_known_call(e::Expr, @nospecialize(func), src, spvals::SimpleVector,
return isa(f, Const) && f.val === func
end

function is_known_call_p(e::Expr, @nospecialize(pred), src, spvals::SimpleVector, slottypes::Vector{Any})
if e.head !== :call
return false
end
f = argextype(e.args[1], src, spvals, slottypes)
return (isa(f, Const) && pred(f.val)) || (isType(f) && pred(f.parameters[1]))
end

function renumber_ir_elements!(body::Vector{Any}, changemap::Vector{Int}, preprocess::Bool = true)
if preprocess
for i = 2:length(changemap)
Expand Down
1 change: 0 additions & 1 deletion base/compiler/ssair/queries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function stmt_effect_free(@nospecialize(stmt), src, spvals::SimpleVector)
isa(stmt, Union{PiNode, PhiNode}) && return true
isa(stmt, Union{ReturnNode, GotoNode, GotoIfNot}) && return false
isa(stmt, GlobalRef) && return isdefined(stmt.mod, stmt.name)
(isa(stmt, Symbol) || isa(stmt, SSAValue) || isa(stmt, Argument)) && return true
isa(stmt, Slot) && return false # Slots shouldn't occur in the IR at this point, but let's be defensive here
if isa(stmt, Expr)
e = stmt::Expr
Expand Down
20 changes: 0 additions & 20 deletions base/compiler/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,6 @@ function is_inlineable_constant(@nospecialize(x))
return isbits(x) && Core.sizeof(x) <= MAX_INLINE_CONST_SIZE
end

# count occurrences up to n+1
function occurs_more(@nospecialize(e), pred, n)
if isa(e,Expr)
head = e.head
is_meta_expr_head(head) && return 0
c = 0
for a = e.args
c += occurs_more(a, pred, n)
if c>n
return c
end
end
return c
end
if pred(e)
return 1
end
return 0
end

###########################
# MethodInstance/CodeInfo #
###########################
Expand Down

2 comments on commit b6f9244

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.