Skip to content

Commit 539c492

Browse files
authored
avoid some over-specialization in the optimizer (JuliaLang#35377)
1 parent 8256be4 commit 539c492

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

base/compiler/ssair/inlining.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3+
@nospecialize
4+
35
struct InvokeData
46
entry::Core.TypeMapEntry
57
types0
@@ -41,15 +43,15 @@ struct ConstantCase
4143
method::Method
4244
sparams::Vector{Any}
4345
metharg::Any
44-
ConstantCase(@nospecialize(val), method::Method, sparams::Vector{Any}, @nospecialize(metharg)) =
46+
ConstantCase(val, method::Method, sparams::Vector{Any}, metharg) =
4547
new(val, method, sparams, metharg)
4648
end
4749

4850
struct DynamicCase
4951
method::Method
5052
sparams::Vector{Any}
5153
metharg::Any
52-
DynamicCase(method::Method, sparams::Vector{Any}, @nospecialize(metharg)) =
54+
DynamicCase(method::Method, sparams::Vector{Any}, metharg) =
5355
new(method, sparams, metharg)
5456
end
5557

@@ -59,12 +61,13 @@ struct UnionSplit
5961
atype # ::Type
6062
cases::Vector{Pair{Any, Any}}
6163
bbs::Vector{Int}
62-
UnionSplit(idx::Int, fully_covered::Bool, @nospecialize(atype),
63-
cases::Vector{Pair{Any, Any}}) =
64+
UnionSplit(idx::Int, fully_covered::Bool, atype, cases::Vector{Pair{Any, Any}}) =
6465
new(idx, fully_covered, atype, cases, Int[])
6566
end
6667
isinvoke(inl::UnionSplit) = false
6768

69+
@specialize
70+
6871
function ssa_inlining_pass!(ir::IRCode, linetable::Vector{LineInfoNode}, sv::OptimizationState)
6972
# Go through the function, performing simple ininlingin (e.g. replacing call by constants
7073
# and analyzing legality of inlining).

base/compiler/ssair/slot2ssa.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ function scan_slot_def_use(nargs::Int, ci::CodeInfo, code::Vector{Any})
5151
for var in result[1:(1+nargs)]
5252
push!(var.defs, 0)
5353
end
54-
for (idx, stmt) in Iterators.enumerate(code)
54+
for idx in 1:length(code)
55+
stmt = code[idx]
5556
scan_entry!(result, idx, stmt)
5657
end
5758
result

0 commit comments

Comments
 (0)